diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 011482d9..e606c233 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1276,14 +1276,19 @@ class ResMrpWorkOrder(models.Model): # for move_line in move.move_line_ids # ) if (workorder.production_id.production_type == '人工线下加工' - and workorder.production_id.programming_state == '已编程'): + ): # and workorder.production_id.programming_state == '已编程' if workorder.is_subcontract is True: if workorder.production_id.state == 'rework': workorder.state = 'waiting' continue purchase_orders_id = self._get_surface_technics_purchase_ids() - if purchase_orders_id.state == 'purchase': + purchase_count = 0 + for purchase_order in purchase_orders_id: + for purchase_order_line in purchase_order.order_line: + if purchase_order_line.product_id.server_product_process_parameters_id.id == workorder.surface_technics_parameters_id.id: + purchase_count = purchase_order_line.product_qty + if purchase_orders_id.state == 'purchase' and purchase_count>=workorder.production_id.product_qty: workorder.state = 'ready' picking_id = workorder.production_id.picking_ids.filtered( lambda wk: wk.location_id.name == '制造前' and wk.location_dest_id.name == '外协加工区')