# Stock Valuation Layer Category Groupby ## Description This module allows grouping by product category in the stock valuation layer reports. ### Problem By default, the `categ_id` field in `stock.valuation.layer` is a related field without storage (`store=False`). This means it cannot be used for grouping in reports and pivot views, even though it can be used for filtering and searching. ### Solution This module makes the `categ_id` field stored (`store=True`) and indexed, which enables: - Grouping by product category in list views - Grouping by product category in pivot views - Grouping by product category in graph views - Better performance when filtering by category ## Installation 1. Install the module from the Apps menu 2. The field will be automatically populated for existing records ## Usage After installation: 1. Go to Inventory > Reporting > Inventory Valuation 2. Switch to Pivot or Graph view 3. Click on "Measures" or group options 4. You will now see "Product Category" available for grouping ## Technical Details The module extends `stock.valuation.layer` model and modifies the `categ_id` field to: - `store=True`: Store the value in the database - `index=True`: Add database index for better performance The field remains a related field, so it will automatically update when the product category changes. ## Bug Tracker Bugs are tracked on [GitHub Issues](https://github.com/OCA/stock-logistics-warehouse/issues). ## Credits ### Contributors * Criptomart ### Maintainers This module is maintained by the OCA. ## Compatibility - Odoo 16.0 - stock_account