Manage explicitly stock_skip_warehouse context
The windows that display product quantities should explicitly manage the stock_skip_warehouse context to ensure static result. issue9041 review253051002
This commit is contained in:
1 parent
9108890a0d
commit
97490c0018
4 files changed
+11
-9
No files matched your search
@@ -111,10 +111,6 @@ class StockMixin(object):
|
||||
Compute the domain to filter records which validates the domain over
|
||||
quantity field.
|
||||
|
||||
The context with keys:
|
||||
stock_skip_warehouse: if set, quantities on a warehouse are no more
|
||||
quantities of all child locations but quantities of the storage
|
||||
zone.
|
||||
location_ids is the list of IDs of locations to take account to compute
|
||||
the stock.
|
||||
grouping defines how stock moves are grouped.
|
||||
@@ -956,9 +952,6 @@ class Move(Workflow, ModelSQL, ModelView):
|
||||
forecast: if set compute the forecast quantity.
|
||||
stock_destinations: A list of location ids. If set, restrict the
|
||||
computation to moves from and to those locations.
|
||||
stock_skip_warehouse: if set, quantities on a warehouse are no more
|
||||
quantities of all child locations but quantities of the storage
|
||||
zone.
|
||||
If with_childs, it computes also for child locations.
|
||||
grouping is a tuple of Move (or Product if prefixed by 'product.')
|
||||
field names and defines how stock moves are grouped.
|
||||
|
||||
@@ -564,12 +564,19 @@ class ProductQuantitiesByWarehouseContext(ModelView):
|
||||
('type', '=', 'warehouse'),
|
||||
],
|
||||
help="The warehouse for which the quantities will be calculated.")
|
||||
stock_skip_warehouse = fields.Boolean(
|
||||
"Only storage zone",
|
||||
help="Check to use only the quantity of the storage zone.")
|
||||
|
||||
@classmethod
|
||||
def default_warehouse(cls):
|
||||
Location = Pool().get('stock.location')
|
||||
return Location.get_default_warehouse()
|
||||
|
||||
@classmethod
|
||||
def default_stock_skip_warehouse(cls):
|
||||
return Transaction().context.get('stock_skip_warehouse')
|
||||
|
||||
|
||||
class OpenProductQuantitiesByWarehouse(Wizard):
|
||||
"Open Product Quantities By Warehouse"
|
||||
|
||||
+2
-2
@@ -152,7 +152,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="res_model">stock.location</field>
|
||||
<field name="domain" eval="[('parent', '=', None)]" pyson="1"/>
|
||||
<field name="context" pyson="1"
|
||||
eval="If(Eval('active_model') == 'product.template', {'product_template': Eval('active_id')}, {'product': Eval('active_id')})"/>
|
||||
eval="If(Eval('active_model') == 'product.template', {'product_template': Eval('active_id'), 'stock_skip_warehouse': False}, {'product': Eval('active_id'), 'stock_skip_warehouse': False})"/>
|
||||
<field name="context_model">product.by_location.context</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_location_quantity_tree_view1">
|
||||
@@ -189,7 +189,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="res_model">stock.location</field>
|
||||
<field name="search_value" eval="['OR', ('quantity', '!=', 0), ('forecast_quantity', '!=', 0)]" pyson="1"/>
|
||||
<field name="context" pyson="1"
|
||||
eval="If(Eval('active_model') == 'product.template', {'product_template': Eval('active_id'), 'with_childs': False}, {'product': Eval('active_id'), 'with_childs': False})"/>
|
||||
eval="If(Eval('active_model') == 'product.template', {'product_template': Eval('active_id'), 'with_childs': False, 'stock_skip_warehouse': False}, {'product': Eval('active_id'), 'with_childs': False, 'stock_skip_warehouse': False})"/>
|
||||
<field name="context_model">product.by_location.context</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_location_quantity_list_view">
|
||||
|
||||
@@ -4,4 +4,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="warehouse"/>
|
||||
<field name="warehouse"/>
|
||||
<label name="stock_skip_warehouse"/>
|
||||
<field name="stock_skip_warehouse"/>
|
||||
</form>
|
||||
Reference in new issue
Block a user