From 3148ce5a1511b358209b95e4b95cca915887ce7d Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 13 May 2025 15:49:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E5=8D=8F=E8=B0=83=E6=8B=A8=E5=8D=95?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E4=BA=A7=E5=93=81=E7=9A=84=E8=B0=83=E6=8B=A8?= =?UTF-8?q?=E5=8D=95=E6=B7=B7=E5=90=88=E5=88=B0=E4=B8=80=E8=B5=B7=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 7 +++++++ sf_manufacturing/models/purchase_order.py | 2 ++ 2 files changed, 9 insertions(+) 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: