From 53658052ae653a5e4e12c07dc459bb621365d2f5 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Fri, 15 Nov 2019 15:00:30 +0000 Subject: [PATCH] [REF] stock: forecast report and quants not below a warehouse On a quotation, the forecast report is opened with a default filter on the warehouse of the quotation. If you remove this filter, quantities not below warehouses (eg in subcontracting or in a repair location) are displayed. From the product form, it's not the case, you never see these quantities. We now add a "warehouse is set" filter that is enabled by default (so you have the same value in the stat button forecast and in opening the report) but you can remove it to see all quantities. task-2061825 --- addons/sale_stock/static/src/js/qty_at_date_widget.js | 1 + addons/stock/models/product.py | 2 -- addons/stock/report/report_stock_quantity.xml | 5 ++++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/sale_stock/static/src/js/qty_at_date_widget.js b/addons/sale_stock/static/src/js/qty_at_date_widget.js index df3d60e8002..57762828cdc 100644 --- a/addons/sale_stock/static/src/js/qty_at_date_widget.js +++ b/addons/sale_stock/static/src/js/qty_at_date_widget.js @@ -83,6 +83,7 @@ var QtyAtDateWidget = Widget.extend({ var additional_context = {}; additional_context.grid_anchor = self.data.delivery_date_grid; additional_context.search_default_warehouse_id = [self.data.warehouse_id.data.id]; + additional_context.search_default_below_warehouse = false; action.context = new Context(action.context, additional_context); action.domain = [ ['product_id', 'in', res] diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 756b1f9bf6d..2b8e1de076c 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -517,7 +517,6 @@ class Product(models.Model): action = self.env.ref('stock.report_stock_quantity_action_product').read()[0] action['domain'] = [ ('product_id', '=', self.id), - ('warehouse_id', '!=', False), ] return action @@ -793,7 +792,6 @@ class ProductTemplate(models.Model): action = self.env.ref('stock.report_stock_quantity_action_product').read()[0] action['domain'] = [ ('product_id', 'in', self.product_variant_ids.ids), - ('warehouse_id', '!=', False), ] return action diff --git a/addons/stock/report/report_stock_quantity.xml b/addons/stock/report/report_stock_quantity.xml index 868f9552105..81ec015759b 100644 --- a/addons/stock/report/report_stock_quantity.xml +++ b/addons/stock/report/report_stock_quantity.xml @@ -26,6 +26,8 @@ + + @@ -40,6 +42,7 @@ graph { 'search_default_filter_forecast': 1, + 'search_default_below_warehouse': 1, 'graph_groupbys': ['date:day', 'state', 'product_id'], } @@ -48,9 +51,9 @@ Forecasted Inventory report.stock.quantity graph - [('warehouse_id', '!=', False)] { 'search_default_filter_forecast': 1, + 'search_default_below_warehouse': 1, 'graph_groupbys': ['date:day', 'state', 'product_id'], }