新增返工向导

This commit is contained in:
jinling.yang
2024-07-03 17:35:29 +08:00
parent 93c3548b40
commit a7a8e73616
9 changed files with 142 additions and 11 deletions

View File

@@ -24,6 +24,7 @@ class MrpProduction(models.Model):
work_order_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')],
string='工单状态', default='未排')
detection_result_ids = fields.One2many('sf.detection.result', 'production_id', '检测报告')
# state = fields.Selection(selection_add=[
# ('pending_scheduling', '待排程'),
# ('pending_processing', '待加工'),
@@ -34,9 +35,10 @@ class MrpProduction(models.Model):
('confirmed', '待排程'),
('pending_cam', '待加工'),
('progress', '加工中'),
('rework', '返工'),
('to_close', 'To Close'),
('done', 'Done'),
('cancel', 'Cancelled')], string='State',
('cancel', '报废')], string='State',
compute='_compute_state', copy=False, index=True, readonly=True,
store=True, tracking=True,
help=" * Draft: The MO is not confirmed yet.\n"
@@ -683,3 +685,34 @@ class MrpProduction(models.Model):
'view_mode': 'tree,form',
})
return action
# 返工
def button_rework(self):
return True
# 报废
def button_scrap_new(self):
return True
# 更新程序
def button_update_program(self):
return True
class sf_detection_result(models.Model):
_name = 'sf.detection.result'
_description = "检测结果"
production_id = fields.Many2one('mrp.production')
processing_panel = fields.Char('加工面')
routing_type = fields.Selection([
('装夹预调', '装夹预调'),
('CNC加工', 'CNC加工')], string="工序类型")
rework_reason = fields.Selection(
[("programming", "编程"), ("cutter", "刀具"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
detailed_reason = fields.Text('详细原因')
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格',
string="检测结果", tracking=True)
test_report = fields.Binary('检测报告', readonly=True)

View File

@@ -200,8 +200,8 @@ class ResMrpWorkOrder(models.Model):
is_remanufacture = fields.Boolean(string='重新生成制造订单', default=False)
is_fetchcnc = fields.Boolean(string='重新获取NC程序', default=False)
reason = fields.Selection(
[("programming", "编程"), ("clamping", "返工"), ("cutter", "刀具"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图"), ("other", "其他"), ], string="原因", tracking=True)
[("programming", "编程"), ("cutter", "刀具"), ("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
detailed_reason = fields.Text('详细原因')
# is_send_program_again = fields.Boolean(string='是否重新下发NC程序', default=False)
@@ -460,6 +460,21 @@ class ResMrpWorkOrder(models.Model):
else:
raise UserError(_("该工单暂未完成,无法进行工件配送"))
def button_rework_pre(self):
# production_ids |= self.production_id
return {
'name': _('返工'),
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'sf.rework.wizard',
'target': 'new',
'context': {
'default_workorder_id': self.id,
'default_production_ids': [(6, 0, [self.production_id.id])],
}}
# 拼接工单对象属性值
def json_workorder_str(self, k, production, route, item):
# 计算预计时长duration_expected