1.优化制造订单的检测结果:新增处理结果字段

2.优化制造订单的返工向导:加工面字段类型改为多对多,且该字段需根据处理结果为待处理的检测结果的加工面进行过滤
3.优化工单工件下产线接口:工单状态为待检测
4,.优化工单状态方法(_compute_state)
This commit is contained in:
jinling.yang
2024-07-12 17:32:53 +08:00
parent 7152b54017
commit 7885794322
9 changed files with 130 additions and 93 deletions

View File

@@ -107,7 +107,8 @@ class MrpProduction(models.Model):
precision_rounding=production.product_uom_id.rounding) >= 0:
production.state = 'to_close'
elif any(
(wo.test_results == '返工' and wo.state == 'done') or wo.state == 'rework' for wo in
(wo.test_results == '返工' and wo.state == 'done') or wo.state == 'rework' or (
wo.is_rework is True and wo.state == 'done') for wo in
production.workorder_ids):
production.state = 'rework'
elif any(wo_state in ('progress', 'done') for wo_state in production.workorder_ids.mapped('state')):
@@ -757,7 +758,8 @@ class MrpProduction(models.Model):
# 返工
def button_rework(self):
self._cron_get_programming_state()
if self.programming_state != '已编程':
self._cron_get_programming_state()
return {
'name': _('返工'),
'type': 'ir.actions.act_window',
@@ -767,7 +769,8 @@ class MrpProduction(models.Model):
'context': {
'default_production_id': self.id,
'default_product_id': self.product_id.id,
'default_programming_state': self.programming_state
'default_programming_state': self.programming_state,
'default_is_reprogramming': True if self.programming_state in ['已编程'] else False
}
}
@@ -870,12 +873,15 @@ class sf_detection_result(models.Model):
('CNC加工', 'CNC加工')], string="工序类型")
rework_reason = fields.Selection(
[("programming", "编程"), ("cutter", "刀具"), ("operate computer", "操机"),
[("programming", "编程"), ("cutter", "刀具"), ("clamping", "装夹"),
("operate computer", "操机"),
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
detailed_reason = fields.Text('详细原因')
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格',
test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")],
string="检测结果", tracking=True)
test_report = fields.Binary('检测报告', readonly=True)
handle_result = fields.Selection([("待处理", "待处理"), ("已处理", "已处理")], default='', string="处理结果",
tracking=True)
# 查看检测报告
def button_look_test_report(self):