Allow to use storage location as input or output location

When the input or output location is the same as the storage location, it can
be of type view.
This commit is contained in:
Cédric Krier
2023-06-05 18:55:41 +02:00
parent b2abd35dca
commit abf3167bcb
2 changed files with 20 additions and 5 deletions
+8 -2
View File
@@ -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)]],
+12 -3
View File
@@ -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)]),
()),