details:   https://code.tryton.org/tryton/commit/ec76aa7c3aea
branch:    default
user:      Sergi Almacellas Abellana <[email protected]>
date:      Sat Oct 25 12:06:20 2025 +0200
description:
        Limit implicit locations to the child of warehouses when supplying for 
internal shipments

        Closes #14262
diffstat:

 modules/stock_supply/shipment.py |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r 30c128ddffac -r ec76aa7c3aea modules/stock_supply/shipment.py
--- a/modules/stock_supply/shipment.py  Sat Oct 25 12:24:26 2025 +0200
+++ b/modules/stock_supply/shipment.py  Sat Oct 25 12:06:20 2025 +0200
@@ -32,6 +32,13 @@
         if not company:
             return
 
+        implicit_location_domain = [
+                ['OR',
+                    ('provisioning_location', '!=', None),
+                    ('overflowing_location', '!=', None),
+                    ],
+                ('type', '=', 'storage'),
+                ]
         clean_request_domain = [
                 ('state', '=', 'request'),
                 ('company', '=', company.id),
@@ -41,6 +48,7 @@
                     ('type', '=', 'warehouse'),
                     ])
         else:
+            implicit_location_domain.append(('parent', 'child_of', warehouses))
             clean_request_domain.append(
                     ['OR',
                         ('to_location.parent', 'child_of', warehouses),
@@ -69,13 +77,7 @@
                 (op.storage_location.id, op.product.id)
                 ] = op
             id2location[op.storage_location.id] = op.storage_location
-        implicit_locations = Location.search([
-                ['OR',
-                    ('provisioning_location', '!=', None),
-                    ('overflowing_location', '!=', None),
-                    ],
-                ('type', '=', 'storage'),
-                ])
+        implicit_locations = Location.search(implicit_location_domain)
         id2location.update({l.id: l for l in implicit_locations})
         location_ids = list(id2location.keys())
 

Reply via email to