[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
This commit is contained in:
Simon Lejeune
2019-12-04 10:40:00 +00:00
parent 4afba9ee68
commit 53658052ae
3 changed files with 5 additions and 3 deletions
@@ -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]
-2
View File
@@ -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
@@ -26,6 +26,8 @@
<filter string="Forecasted Receipts" name="filter_in" domain="[('state', '=', 'in')]"/>
<filter string="Forecasted Deliveries" name="filter_out" domain="[('state', '=', 'out')]"/>
<filter string="Date" name="filter_date" date="date"/>
<separator/>
<filter string="Warehouse is set" name="below_warehouse" domain="[('warehouse_id', '!=', False)]"/>
</group>
<group expand="0" string="Group By">
<filter string="Date" name="groupby_date" domain="[]" context="{'group_by':'date:day'}"/>
@@ -40,6 +42,7 @@
<field name="view_mode">graph</field>
<field name="context">{
'search_default_filter_forecast': 1,
'search_default_below_warehouse': 1,
'graph_groupbys': ['date:day', 'state', 'product_id'],
}</field>
</record>
@@ -48,9 +51,9 @@
<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,
'search_default_below_warehouse': 1,
'graph_groupbys': ['date:day', 'state', 'product_id'],
}</field>
</record>