details:   https://code.tryton.org/tryton/commit/1aa6f48cf8ed
branch:    default
user:      Cédric Krier <[email protected]>
date:      Tue Sep 22 09:47:03 2026 +0200
description:
        Prevent the provisioning and overflowing locations from being a child 
of the order point location

        Closes #12410 #14196
diffstat:

 modules/stock_consignment/stock.py  |   8 ++------
 modules/stock_supply/order_point.py |  33 +++++++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r 15fcaa9f4733 -r 1aa6f48cf8ed modules/stock_consignment/stock.py
--- a/modules/stock_consignment/stock.py        Thu Sep 03 15:28:26 2026 +0200
+++ b/modules/stock_consignment/stock.py        Tue Sep 22 09:47:03 2026 +0200
@@ -383,9 +383,5 @@
     __name__ = 'stock.order_point'
 
     @classmethod
-    def __setup__(cls):
-        super().__setup__()
-        cls.provisioning_location.domain = ['OR',
-            cls.provisioning_location.domain,
-            ('type', '=', 'supplier'),
-            ]
+    def _provisioning_types(cls):
+        return super()._provisioning_types() + ['supplier']
diff -r 15fcaa9f4733 -r 1aa6f48cf8ed modules/stock_supply/order_point.py
--- a/modules/stock_supply/order_point.py       Thu Sep 03 15:28:26 2026 +0200
+++ b/modules/stock_supply/order_point.py       Tue Sep 22 09:47:03 2026 +0200
@@ -42,7 +42,13 @@
             ])
     provisioning_location = fields.Many2One(
         'stock.location', 'Provisioning Location',
-        domain=[('type', 'in', ['storage', 'view'])],
+        domain=[
+            ['OR',
+                ('provisioning_location', '=', None),
+                ('provisioning_location.parent',
+                    'not child_of', [Eval('location', -1)]),
+                ],
+            ],
         states={
             'invisible': Eval('type') != 'internal',
             'required': ((Eval('type') == 'internal')
@@ -50,7 +56,13 @@
         })
     overflowing_location = fields.Many2One(
         'stock.location', 'Overflowing Location',
-        domain=[('type', 'in', ['storage', 'view'])],
+        domain=[
+            ['OR',
+                ('overflowing_location', '=', None),
+                ('overflowing_location.parent',
+                    'not child_of', [Eval('location', -1)]),
+                ],
+            ],
         states={
             'invisible': Eval('type') != 'internal',
             'required': ((Eval('type') == 'internal')
@@ -117,6 +129,23 @@
                 Unique(t, t.product, t.location, t.company),
                 'stock_supply.msg_order_point_unique'))
 
+        cls.provisioning_location.domain = [
+            cls.provisioning_location.domain,
+            ('type', 'in', cls._provisioning_types()),
+            ]
+        cls.overflowing_location.domain = [
+            cls.overflowing_location.domain,
+            ('type', 'in', cls._overflowing_types()),
+            ]
+
+    @classmethod
+    def _provisioning_types(cls):
+        return ['storage', 'view']
+
+    @classmethod
+    def _overflowing_types(cls):
+        return ['storage', 'view']
+
     @classmethod
     def __register__(cls, module):
         table = cls.__table__()

Reply via email to