diff --git a/modules/stock/location.py b/modules/stock/location.py index 2dc0a9a118..210195c067 100644 --- a/modules/stock/location.py +++ b/modules/stock/location.py @@ -78,7 +78,10 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView): 'required': Eval('type') == 'warehouse', }, domain=[ - ('type', '=', 'storage'), + ['OR', + ('type', '=', 'storage'), + ('id', '=', Eval('storage_location', -1)), + ], ['OR', ('parent', 'child_of', [Eval('id', -1)]), ('parent', '=', None), @@ -91,7 +94,10 @@ class Location(DeactivableMixin, tree(), ModelSQL, ModelView): 'required': Eval('type') == 'warehouse', }, domain=[ - ('type', '=', 'storage'), + ['OR', + ('type', '=', 'storage'), + ('id', '=', Eval('storage_location', -1)), + ], ['OR', ('parent', 'child_of', [Eval('id', -1)]), ('parent', '=', None)]], diff --git a/modules/stock/shipment.py b/modules/stock/shipment.py index fb25cdde98..22034a576f 100644 --- a/modules/stock/shipment.py +++ b/modules/stock/shipment.py @@ -185,7 +185,10 @@ class ShipmentIn(ShipmentMixin, Workflow, ModelSQL, ModelView): warehouse_input = fields.Many2One( 'stock.location', "Warehouse Input", required=True, domain=[ - ('type', '=', 'storage'), + ['OR', + ('type', '=', 'storage'), + ('id', '=', Eval('warehouse_storage', -1)), + ], If(Eval('state') == 'draft', ('parent', 'child_of', [Eval('warehouse', -1)]), ()), @@ -1079,7 +1082,10 @@ class ShipmentOut(ShipmentAssignMixin, Workflow, ModelSQL, ModelView): warehouse_output = fields.Many2One( 'stock.location', "Warehouse Output", required=True, domain=[ - ('type', '=', 'storage'), + ['OR', + ('type', '=', 'storage'), + ('id', '=', Eval('warehouse_output', -1)), + ], If(Eval('state') == 'draft', ('parent', 'child_of', [Eval('warehouse', -1)]), ()), @@ -1796,7 +1802,10 @@ class ShipmentOutReturn(ShipmentMixin, Workflow, ModelSQL, ModelView): warehouse_input = fields.Many2One( 'stock.location', "Warehouse Input", required=True, domain=[ - ('type', '=', 'storage'), + ['OR', + ('type', '=', 'storage'), + ('id', '=', Eval('warehouse_storage', -1)), + ], If(Eval('state') == 'draft', ('parent', 'child_of', [Eval('warehouse', -1)]), ()),