diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index f8475338..ee1c0c75 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -502,6 +502,7 @@ class ResMrpWorkOrder(models.Model): # if technology_design.is_auto is False: # domain = [('origin', '=', self.production_id.name)] # else: + purchase_orders_id = self._get_surface_technics_purchase_ids() result = { "type": "ir.actions.act_window", @@ -1297,6 +1298,8 @@ class ResMrpWorkOrder(models.Model): move_out = picking_id.move_ids # move_out = workorder.move_subcontract_workorder_ids[1] for mo in move_out: + if workorder.production_id.bom_id.bom_line_ids.product_id.id != move_out.product_id: + continue if mo.state != 'done': mo.write({'state': 'assigned', 'production_id': False}) if not mo.move_line_ids: @@ -1338,6 +1341,8 @@ class ResMrpWorkOrder(models.Model): wk: wk.location_id.name == '制造前' and wk.location_dest_id.name == '外协加工区') move_out = picking_id.move_ids for mo in move_out: + if workorder.production_id.bom_id.bom_line_ids.product_id.id != move_out.product_id: + continue if mo.state != 'done': mo.write({'state': 'assigned', 'production_id': False}) if not mo.move_line_ids: @@ -1421,6 +1426,8 @@ class ResMrpWorkOrder(models.Model): # [('barcode', 'ilike', 'VL-SPOC')]).id), # ('origin', '=', self.production_id.name), ('state', 'not in', ['cancel', 'done'])]) for mo in move_out: + if self.production_id.bom_id.bom_line_ids.product_id.id != move_out.product_id: + continue if mo.state != 'done': mo.write({'state': 'assigned', 'production_id': False}) if not mo.move_line_ids: diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py index 056d822d..d0d716d4 100644 --- a/sf_manufacturing/models/purchase_order.py +++ b/sf_manufacturing/models/purchase_order.py @@ -131,6 +131,8 @@ class PurchaseOrder(models.Model): lambda wk: wk.location_id.name == '制造前' and wk.location_dest_id.name == '外协加工区') move_out = picking_id.move_ids for mo in move_out: + if production_id.bom_id.bom_line_ids.product_id.id != move_out.product_id: + continue if mo.state != 'done': mo.write({'state': 'assigned', 'production_id': False}) if not mo.move_line_ids: