diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index 80ae21e7..e42bb1c7 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -214,8 +214,8 @@ class Manufacturing_Connect(http.Controller): res = {'Succeed': False, 'ErrorCode': 202, 'Error': '该工单未开始'} return json.JSONEncoder().encode(res) workorder.button_finish() - workorder.process_state = '待解除装夹' - workorder.sudo().production_id.process_state = '待解除装夹' + # workorder.process_state = '待解除装夹' + # workorder.sudo().production_id.process_state = '待解除装夹' # 根据工单的实际结束时间修改排程单的结束时间、状态,同时修改销售订单的状态 if workorder.date_finished: diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index e2d6616a..a96f3383 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -67,7 +67,7 @@ class MrpProduction(models.Model): ('待加工', '待加工'), ('待解除装夹', '待解除装夹'), ('已完工', '已完工'), - ], string='工序状态', related='workorder_ids.process_state', store=True) + ], string='工序状态') # 零件图号 part_number = fields.Char('零件图号') diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 5c8ecdd6..704b0ec5 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -412,8 +412,8 @@ class ResMrpWorkOrder(models.Model): work = workorder.production_id.workorder_ids work.compensation_value_x = eval(self.material_center_point)[0] work.compensation_value_y = eval(self.material_center_point)[1] - work.process_state = '待加工' - self.sudo().production_id.state = 'pending_processing' + # work.process_state = '待加工' + # self.sudo().production_id.process_state = '待加工' self.date_finished = datetime.now() workorder.button_finish() @@ -828,6 +828,14 @@ class ResMrpWorkOrder(models.Model): if not record.rfid_code: raise UserError("请扫RFID码进行绑定") record.workpiece_delivery_ids[0].write({'status': '待下发'}) + record.process_state = '待加工' + # record.write({'process_state': '待加工'}) + record.production_id.process_state = '待加工' + + if record.routing_type == 'CNC加工': + record.process_state = '待解除装夹' + # record.write({'process_state': '待加工'}) + record.production_id.process_state = '待解除装夹' if record.routing_type == '解除装夹': ''' @@ -869,6 +877,7 @@ class ResMrpWorkOrder(models.Model): for move_raw_id in record.production_id.move_raw_ids: move_raw_id.quantity_done = move_raw_id.product_uom_qty record.process_state = '已完工' + record.production_id.process_state = '已完工' record.production_id.button_mark_done1() # self.production_id.state = 'done'