details:   https://code.tryton.org/tryton/commit/91493426a8dd
branch:    7.0
user:      Cédric Krier <[email protected]>
date:      Fri Oct 30 09:31:43 2026 +0100
description:
        Do not test the locations for other variants when setting stock move 
locations

        Closes #15203
        (grafted from 8bbb83c3f4d68f45bdd8f4a6893ef75c5349b4ca)
diffstat:

 modules/stock_product_location/location.py |   3 +--
 modules/stock_product_location/product.py  |  11 +++++++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 2fb913af01e1 -r 91493426a8dd modules/stock_product_location/location.py
--- a/modules/stock_product_location/location.py        Fri Oct 30 10:18:56 
2026 +0100
+++ b/modules/stock_product_location/location.py        Fri Oct 30 09:31:43 
2026 +0100
@@ -67,8 +67,7 @@
             pattern.setdefault('template', self.product.template.id)
             pattern.setdefault('product', self.product.id)
 
-        locations = self.product.locations + self.product.template.locations
-        for product_location in locations:
+        for product_location in self.product.locations_used:
             if product_location.match(pattern):
                 setattr(self, field, product_location.location)
                 break
diff -r 2fb913af01e1 -r 91493426a8dd modules/stock_product_location/product.py
--- a/modules/stock_product_location/product.py Fri Oct 30 10:18:56 2026 +0100
+++ b/modules/stock_product_location/product.py Fri Oct 30 09:31:43 2026 +0100
@@ -37,6 +37,10 @@
                         })
         return new_templates
 
+    @property
+    def locations_used(self):
+        yield from self.locations
+
 
 class Product(metaclass=PoolMeta):
     __name__ = 'product.product'
@@ -77,3 +81,10 @@
                         'template': lambda d: template2new[d['template']],
                         })
         return new_products
+
+    @property
+    def locations_used(self):
+        yield from self.locations
+        for location in self.template.locations_used:
+            if not location.product:
+                yield location

Reply via email to