[FIX] stock: forecast quantity only on warehouse

Before this commit, forecasted quantity in the product stat button and
in graph/grid view wasn't always equals.
The issue was the forecasted quantity is based on quant in location who
is child of warehouse location, and the `report.inventory.quantity` used
in graph/grid view didn't filter on warehouse location (took all
internal location).
So, completes the domain on `report.inventory.quantity` to get only
quantity in the warehouse.
Same change is applied to the Forecasted Inventory report.

Task #2058665
This commit is contained in:
svs-odoo
2019-09-03 13:31:22 +00:00
parent 63852bc1a1
commit d3ef8a958b
2 changed files with 9 additions and 2 deletions
+8 -2
View File
@@ -511,7 +511,10 @@ class Product(models.Model):
def action_product_forecast_report(self):
action = self.env.ref('stock.report_stock_quantity_action_product').read()[0]
action['domain'] = [('product_id', '=', self.id)]
action['domain'] = [
('product_id', '=', self.id),
('warehouse_id', '!=', False),
]
return action
@api.model
@@ -779,7 +782,10 @@ class ProductTemplate(models.Model):
def action_product_tmpl_forecast_report(self):
action = self.env.ref('stock.report_stock_quantity_action').read()[0]
action['domain'] = [('product_id', 'in', self.product_variant_ids.ids)]
action['domain'] = [
('product_id', 'in', self.product_variant_ids.ids),
('warehouse_id', '!=', False),
]
return action
class ProductCategory(models.Model):
@@ -48,6 +48,7 @@
<field name="name">Forecasted Inventory</field>
<field name="res_model">report.stock.quantity</field>
<field name="view_mode">graph</field>
<field name="domain">[('warehouse_id', '!=', False)]</field>
<field name="context">{
'search_default_filter_forecast': 1,
'graph_groupbys': ['date:day', 'state', 'product_id'],