Skip to content

Commit

Permalink
[UPD] product category in tree view and pivot
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsirintanis committed Mar 19, 2024
1 parent f6a874a commit 0b9dd30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions sale_forecast/models/sale_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class SaleForecast(models.Model):
product_id = fields.Many2one(
comodel_name="product.product", string="Product", required=True
)
categ_id = fields.Many2one(related="product_id.categ_id", store=True)
product_uom = fields.Many2one(comodel_name="uom.uom", string="Unit of measure")
location_id = fields.Many2one(
comodel_name="stock.location", string="Location", required=True
Expand Down
9 changes: 9 additions & 0 deletions sale_forecast/views/sale_forecast_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<field name="date_from" string="Date From" />
<field name="date_to" string="Date To" />
<field name="product_id" />
<field name="categ_id" />
<field name="location_id" />
<field name="product_uom_qty" />
<field name="product_uom" />
Expand Down Expand Up @@ -52,6 +53,7 @@
<field name="arch" type="xml">
<pivot string="Stock Demand Estimate">
<field name="product_qty" type="measure" />
<field name="categ_id" type="row" />
<field name="product_id" type="row" />
<field name="date_range_id" type="col" />
<field name="date_from" type="col" />
Expand All @@ -77,6 +79,7 @@
<field name="arch" type="xml">
<search string="Search Sale Forecast">
<field name="product_id" />
<field name="categ_id" />
<field name="location_id" />
<field name="date_range_id" />
<separator />
Expand All @@ -98,6 +101,12 @@
domain="[]"
context="{'group_by':'product_id'}"
/>
<filter
string="Product Category"
name="groupby_product_category"
domain="[]"
context="{'group_by':'categ_id'}"
/>
<filter
string="Location"
name="groupby_location"
Expand Down

0 comments on commit 0b9dd30

Please sign in to comment.