details:   https://code.tryton.org/tryton/commit/4e08e28f5258
branch:    default
user:      Cédric Krier <[email protected]>
date:      Sat Oct 25 12:24:03 2025 +0200
description:
        Filter order points using child of operator when supplying with 
internal shipments
diffstat:

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

diffs (37 lines):

diff -r ec76aa7c3aea -r 4e08e28f5258 modules/stock_supply/shipment.py
--- a/modules/stock_supply/shipment.py  Sat Oct 25 12:06:20 2025 +0200
+++ b/modules/stock_supply/shipment.py  Sat Oct 25 12:24:03 2025 +0200
@@ -43,6 +43,10 @@
                 ('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 @@
                         ('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 @@
             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 = {}

Reply via email to