From abfac280940606e0fba7ee344b3653a0b048966e Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Sat, 28 Dec 2024 09:12:27 +0800 Subject: [PATCH] =?UTF-8?q?sorted=5Fworkorders=E5=8F=98=E9=87=8F=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 011c5f7e..5c304de4 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -846,6 +846,8 @@ class MrpProduction(models.Model): # self.env['stock.picking'].create_outcontract_picking(consecutive_workorders, production) # self.env['purchase.order'].get_purchase_order(consecutive_workorders, production, # product_id_to_production_names) + if not sorted_workorders: + return for workorders in reversed(sorted_workorders): self.env['stock.picking'].create_outcontract_picking(workorders, production, sorted_workorders) self.env['purchase.order'].get_purchase_order(workorders, production, product_id_to_production_names)