From 8afc8bb3a65ba7c1ddfe88a9a3735f3c11c9dcfb Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Wed, 14 May 2025 10:03:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E5=8D=8F=E8=B0=83=E6=8B=A8=E5=8D=95?= =?UTF-8?q?=E5=8F=AA=E6=9C=89=E5=BD=93=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=8F=98=E4=B8=BA=E5=B7=B2=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E6=89=8D=E8=83=BD=E5=B0=B1=E7=BB=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jikimo_purchase_request/models/mrp_production.py | 9 +++++---- sf_manufacturing/models/mrp_workorder.py | 8 ++++---- sf_manufacturing/models/purchase_order.py | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/jikimo_purchase_request/models/mrp_production.py b/jikimo_purchase_request/models/mrp_production.py index 5c86947f..629392d6 100644 --- a/jikimo_purchase_request/models/mrp_production.py +++ b/jikimo_purchase_request/models/mrp_production.py @@ -19,8 +19,9 @@ class MrpProduction(models.Model): # item.pr_mp_count = len(pr_ids) # 由于采购申请合并了所有销售订单行的采购,所以不区分产品 first_mp = self.env['mrp.production'].search( - [('origin', '=', item.origin)], limit=1, order='id asc') - pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', first_mp.name)]) + [('origin', '=', item.origin)], limit=1, order='id asc') + pr_ids = self.env['purchase.request'].sudo().search( + [('origin', 'like', first_mp.name), ('is_subcontract', '!=', 'True')]) item.pr_mp_count = len(pr_ids) # pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', item.name), ('is_subcontract', '!=', 'True')]) @@ -31,8 +32,8 @@ class MrpProduction(models.Model): self.ensure_one() first_mp = self.env['mrp.production'].search( [('origin', '=', self.origin)], limit=1, order='id asc') - pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', first_mp.name)]) - + pr_ids = self.env['purchase.request'].sudo().search( + [('origin', 'like', first_mp.name), ('is_subcontract', '!=', 'True')]) action = { 'res_model': 'purchase.request', diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index ee1c0c75..4d56312a 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1284,7 +1284,7 @@ class ResMrpWorkOrder(models.Model): # for move_line in move.move_line_ids # ) if (workorder.production_id.production_type == '人工线下加工' - and workorder.production_id.schedule_state == '已排'): + and workorder.production_id.programming_state == '已编程'): # and workorder.production_id.programming_state == '已编程' if workorder.is_subcontract is True: if workorder.production_id.state == 'rework': @@ -1298,7 +1298,7 @@ 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: + if workorder.production_id.bom_id.bom_line_ids.product_id.id != mo.product_id.id: continue if mo.state != 'done': mo.write({'state': 'assigned', 'production_id': False}) @@ -1341,7 +1341,7 @@ 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: + if workorder.production_id.bom_id.bom_line_ids.product_id.id != mo.product_id.id: continue if mo.state != 'done': mo.write({'state': 'assigned', 'production_id': False}) @@ -1426,7 +1426,7 @@ 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: + if self.production_id.bom_id.bom_line_ids.product_id.id != mo.product_id.id: continue if mo.state != 'done': mo.write({'state': 'assigned', 'production_id': False}) diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py index d0d716d4..d79425de 100644 --- a/sf_manufacturing/models/purchase_order.py +++ b/sf_manufacturing/models/purchase_order.py @@ -131,7 +131,7 @@ 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: + if production_id.bom_id.bom_line_ids.product_id.id != mo.product_id.id: continue if mo.state != 'done': mo.write({'state': 'assigned', 'production_id': False})