diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index f8a22b28..433feccc 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -1574,7 +1574,7 @@ class MrpProduction(models.Model): vals['picking_type_id'] = picking_type_id vals['name'] = self.env['stock.picking.type'].browse(picking_type_id).sequence_id.next_by_id() product_id = self.env['product.product'].browse(vals['product_id']) - is_self_process = product_id.materials_type_id and product_id.materials_type_id.gain_way and product_id.materials_type_id.gain_way != '自加工' + is_self_process = product_id.materials_type_id.gain_way if product_id.materials_type_id else None is_customer_provided = product_id.is_customer_provided key = f"{is_self_process}_{is_customer_provided}" if not is_custemer_group_id.get(key): diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 4b877aa7..9c43db92 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1198,11 +1198,7 @@ class ResMrpWorkOrder(models.Model): 'cmm_ids': production.workorder_ids.filtered(lambda t: t.routing_type == 'CNC加工').cmm_ids, }] return workorders_values_str - - @api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state', - 'production_id.tool_state', 'production_id.schedule_state', 'sequence', - 'production_id.programming_state') - def _compute_state(self): + def _process_compute_state(self): for workorder in self: # 如果工单的工序没有进行排序则跳出循环 if workorder.production_id.workorder_ids.filtered(lambda wk: wk.sequence == 0): @@ -1289,7 +1285,20 @@ class ResMrpWorkOrder(models.Model): mo.get_move_line(workorder.production_id, workorder)) else: workorder.state = 'waiting' - + @api.depends('production_availability', 'blocked_by_workorder_ids', 'blocked_by_workorder_ids.state', + 'production_id.tool_state', 'production_id.schedule_state', 'sequence', + 'production_id.programming_state') + def _compute_state(self): + self._process_compute_state() + for workorder in self: + if workorder.state == 'waiting' or workorder.state == 'pending': + for check_id in workorder.check_ids: + if not check_id.is_inspect: + check_id.quality_state = 'waiting' + if workorder.state == 'ready': + for check_id in workorder.check_ids: + if not check_id.is_inspect: + check_id.quality_state = 'none' # 重写工单开始按钮方法 def button_start(self): # 判断工单状态是否为等待组件