From a587493a310fda5833b630e0ff7cb201e7d79cdc Mon Sep 17 00:00:00 2001 From: Arnaud Baes Date: Mon, 12 Aug 2019 12:50:27 +0000 Subject: [PATCH] [IMP] stock: Forecast Report cleanup --- addons/stock/models/product.py | 10 ++++++++++ addons/stock/report/report_stock_quantity.xml | 3 ++- addons/stock/views/product_views.xml | 12 ++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 66941e1ddc6..9ae063cc7a7 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -497,6 +497,11 @@ class Product(models.Model): def action_update_quantity_on_hand(self): return self.product_tmpl_id.with_context({'default_product_id': self.id}).action_update_quantity_on_hand() + def action_product_forecast_report(self): + action = self.env.ref('stock.report_stock_quantity_action_product').read()[0] + action['domain'] = [('product_id', '=', self.id)] + return action + @api.model def get_theoretical_quantity(self, product_id, location_id, lot_id=None, package_id=None, owner_id=None, to_uom=None): product_id = self.env['product.product'].browse(product_id) @@ -759,6 +764,11 @@ class ProductTemplate(models.Model): return action + 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)] + return action + class ProductCategory(models.Model): _inherit = 'product.category' diff --git a/addons/stock/report/report_stock_quantity.xml b/addons/stock/report/report_stock_quantity.xml index 39a030e3e14..f9a2e1c00bb 100644 --- a/addons/stock/report/report_stock_quantity.xml +++ b/addons/stock/report/report_stock_quantity.xml @@ -25,6 +25,7 @@ + @@ -39,7 +40,7 @@ graph { 'search_default_filter_forecast': 1, - 'graph_groupbys': ['date:day', 'state'], + 'graph_groupbys': ['date:day', 'state', 'product_id'], } diff --git a/addons/stock/views/product_views.xml b/addons/stock/views/product_views.xml index 34a9c821b46..1d5155175a3 100644 --- a/addons/stock/views/product_views.xml +++ b/addons/stock/views/product_views.xml @@ -225,10 +225,10 @@ On Hand - -