1.制造订单添加报废状态,
2.返工操作制造订单添加过滤条件:状态为报废 3.cnc工单完成检测结果添加报废
This commit is contained in:
@@ -77,9 +77,10 @@ class MrpProduction(models.Model):
|
||||
('pending_cam', '待加工'),
|
||||
('progress', '加工中'),
|
||||
('rework', '返工'),
|
||||
('scrap', '报废'),
|
||||
('to_close', 'To Close'),
|
||||
('done', 'Done'),
|
||||
('cancel', '报废')], 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"
|
||||
@@ -166,7 +167,7 @@ class MrpProduction(models.Model):
|
||||
production.state = 'pending_cam'
|
||||
|
||||
if production.state == 'progress':
|
||||
if all(wo_state not in ('progress', 'done', 'rework') for wo_state in
|
||||
if all(wo_state not in ('progress', 'done', 'rework', 'scrap') for wo_state in
|
||||
production.workorder_ids.mapped('state')):
|
||||
production.state = 'pending_cam'
|
||||
if production.is_rework is True:
|
||||
@@ -184,9 +185,11 @@ class MrpProduction(models.Model):
|
||||
for wo in
|
||||
production.workorder_ids):
|
||||
production.state = 'rework'
|
||||
if any(wo.test_results == '报废' and wo.state == 'done' for wo in production.workorder_ids):
|
||||
production.state = 'scrap'
|
||||
# 如果制造订单的功能刀具为【无效刀】则制造订单状态改为返工
|
||||
# if production.tool_state == '2':
|
||||
# production.state = 'rework'
|
||||
if production.tool_state == '2':
|
||||
production.state = 'rework'
|
||||
|
||||
def action_check(self):
|
||||
"""
|
||||
@@ -866,7 +869,7 @@ class MrpProduction(models.Model):
|
||||
if download_state is False:
|
||||
raise UserError('编程单号为%s的CNC程序文件从FTP拉取失败' % (self.programming_no))
|
||||
productions = self.env['mrp.production'].search(
|
||||
[('programming_no', '=', self.programming_no), ('state', 'not in', ('cancel', 'done'))])
|
||||
[('programming_no', '=', self.programming_no), ('state', 'not in', ('cancel', 'done', 'scrap'))])
|
||||
if productions:
|
||||
for production in productions:
|
||||
panel_workorder = production.workorder_ids.filtered(lambda
|
||||
|
||||
Reference in New Issue
Block a user