diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 35cd2234..df303c9c 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1312,6 +1312,7 @@ class ResMrpWorkOrder(models.Model): else: workorder.state = 'ready' continue + continue # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' or workorder.production_id.schedule_state != '已排' @@ -1327,9 +1328,7 @@ class ResMrpWorkOrder(models.Model): if workorder.is_subcontract is False: workorder.state = 'ready' else: - if len(workorder.production_id.picking_ids.filtered( - lambda w: w.state not in ['done', - 'cancel'])) == 0 and workorder.production_id.programming_state == '已编程': + if workorder.production_id.programming_state == '已编程': purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id: if purchase_orders_id.state == 'purchase': diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py index 8fbd6c9d..d73e3f03 100644 --- a/sf_manufacturing/models/purchase_order.py +++ b/sf_manufacturing/models/purchase_order.py @@ -152,6 +152,8 @@ class PurchaseOrder(models.Model): for line in self.order_line: # 将产品不追踪序列号的行项目设置qty_done + if not line.move_ids: + continue if line.move_ids[0].product_id.tracking == 'none': line.move_ids[0].quantity_done = line.move_ids[0].product_qty return res