diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 14e936a1..9674d5a2 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -842,6 +842,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)