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})