From a2ad9560bbe5db870e6efb98f1d536a7b3345c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 25 Oct 2025 12:24:03 +0200 Subject: [PATCH] Filter order points using child of operator when supplying with internal shipments --- modules/stock_supply/shipment.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/stock_supply/shipment.py b/modules/stock_supply/shipment.py index b795104561..16a27de7f2 100644 --- a/modules/stock_supply/shipment.py +++ b/modules/stock_supply/shipment.py @@ -43,6 +43,10 @@ class ShipmentInternal(ModelSQL, ModelView): ('state', '=', 'request'), ('company', '=', company.id), ] + order_point_domain = [ + ('type', '=', 'internal'), + ('company', '=', company.id), + ] if not warehouses: warehouses = Location.search([ ('type', '=', 'warehouse'), @@ -54,6 +58,8 @@ class ShipmentInternal(ModelSQL, ModelView): ('to_location.parent', 'child_of', warehouses), ('from_location.parent', 'child_of', warehouses), ]) + order_point_domain.append( + ('location.parent', 'child_of', warehouses)) today = Date.today() lead_time = LeadTime.get_max_lead_time() @@ -62,12 +68,7 @@ class ShipmentInternal(ModelSQL, ModelView): cls.delete(cls.search(clean_request_domain)) # fetch quantities on order points - order_points = OrderPoint.search([ - ('type', '=', 'internal'), - ('company', '=', company.id) - ]) - order_points = [ - op for op in order_points if op.location.warehouse in warehouses] + order_points = OrderPoint.search(order_point_domain) id2product = {} product2op = {} id2location = {}