diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 04d4b2c0..007b2554 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -265,6 +265,23 @@ class MrpProduction(models.Model): part_name = fields.Char(string='零件名称', related='product_id.part_name', readonly=True) + # 判断制造的产品类型 + production_product_type = fields.Selection([ + ('成品', '成品'), + ('坯料', '坯料'), + ('其他', '其他') + ], string='产品类型', default='成品') + + @api.onchange('product_id') + def onchange_product_id(self): + for record in self: + if record.product_id.categ_id.type == '成品': + record.production_product_type = '成品' + elif record.product_id.categ_id.type == '坯料': + record.production_product_type = '坯料' + else: + record.production_product_type = '其他' + @api.depends('product_id.manual_quotation') def _compute_manual_quotation(self): for item in self: diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index d22a4c06..b14955e4 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1217,6 +1217,7 @@ class ResMrpWorkOrder(models.Model): # ================= 如果制造订单制造类型为【人工线下加工】========================== if (workorder.production_id.production_type == '人工线下加工' and workorder.production_id.schedule_state == '已排' + and workorder.routing_type == '人工线下加工' and len(workorder.production_id.picking_ids.filtered( lambda w: w.state not in ['done', 'cancel'])) == 0 and workorder.production_id.programming_state == '已编程'): diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml index e3b29c93..2d048153 100644 --- a/sf_manufacturing/views/mrp_production_addional_change.xml +++ b/sf_manufacturing/views/mrp_production_addional_change.xml @@ -116,12 +116,13 @@ + + attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}"/> + attrs="{'invisible': [('production_type', 'not in', ['自动化产线加工', '人工线下加工']), ('production_product_type', '!=', '成品')]}"/> @@ -416,7 +417,9 @@ 子MO - + + +