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)