Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
eb0483a8 by Cédric Krier at 2023-06-05T18:20:44+02:00
Allow to store view location as warehouse storage on shipments

It is allowed to have a view location as storage for a warehouse so the
shipment should support it.

Closes #12307
- - - - -
8b451e1f by Cédric Krier at 2023-06-05T18:55:41+02:00
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.
- - - - -


2 changed files:

- modules/stock/location.py
- modules/stock/shipment.py


Changes:

=====================================
modules/stock/location.py
=====================================
@@ -78,7 +78,10 @@
             '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 @@
             'required': Eval('type') == 'warehouse',
         },
         domain=[
-            ('type', '=', 'storage'),
+            ['OR',
+                ('type', '=', 'storage'),
+                ('id', '=', Eval('storage_location', -1)),
+                ],
             ['OR',
                 ('parent', 'child_of', [Eval('id', -1)]),
                 ('parent', '=', None)]],


=====================================
modules/stock/shipment.py
=====================================
@@ -185,7 +185,10 @@
     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)]),
                 ()),
@@ -196,7 +199,7 @@
     warehouse_storage = fields.Many2One(
         'stock.location', "Warehouse Storage", required=True,
         domain=[
-            ('type', '=', 'storage'),
+            ('type', 'in', ['storage', 'view']),
             If(Eval('state') == 'draft',
                 ('parent', 'child_of', [Eval('warehouse', -1)]),
                 ()),
@@ -1068,7 +1071,7 @@
     warehouse_storage = fields.Many2One(
         'stock.location', "Warehouse Storage", required=True,
         domain=[
-            ('type', '=', 'storage'),
+            ('type', 'in', ['storage', 'view']),
             If(Eval('state') == 'draft',
                 ('parent', 'child_of', [Eval('warehouse', -1)]),
                 ()),
@@ -1079,7 +1082,10 @@
     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)]),
                 ()),
@@ -1785,7 +1791,7 @@
     warehouse_storage = fields.Many2One(
         'stock.location', "Warehouse Storage", required=True,
         domain=[
-            ('type', '=', 'storage'),
+            ('type', 'in', ['storage', 'view']),
             If(Eval('state') == 'draft',
                 ('parent', 'child_of', [Eval('warehouse', -1)]),
                 ()),
@@ -1796,7 +1802,10 @@
     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)]),
                 ()),



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/7793a196b770c67a36dc7c5d7033c2e03c3b2fef...8b451e1fa19f38017dae7c63e22ac4a6f8269a51

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/7793a196b770c67a36dc7c5d7033c2e03c3b2fef...8b451e1fa19f38017dae7c63e22ac4a6f8269a51
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to