From 60dc754bea90fce2abe78fb3b585ec25782082e7 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Sat, 25 Oct 2025 12:06:20 +0200 Subject: [PATCH] Limit implicit locations to the child of warehouses when supplying for internal shipments Closes #14262 --- modules/stock_supply/shipment.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/stock_supply/shipment.py b/modules/stock_supply/shipment.py index 4efb5934c1..b795104561 100644 --- a/modules/stock_supply/shipment.py +++ b/modules/stock_supply/shipment.py @@ -32,6 +32,13 @@ class ShipmentInternal(ModelSQL, ModelView): 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 @@ class ShipmentInternal(ModelSQL, ModelView): ('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 @@ class ShipmentInternal(ModelSQL, ModelView): (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())