修复多次返工报依赖问题
This commit is contained in:
@@ -99,9 +99,12 @@ class ReworkWizard(models.TransientModel):
|
||||
self.production_id.get_new_program(panel.name)
|
||||
if self.reprogramming_num >= 0 and self.programming_state == '已下发':
|
||||
ret = {'programming_list': []}
|
||||
cnc_rework = self.production_id.workorder_ids.filtered(
|
||||
lambda crw: crw.processing_panel == panel.name and crw.state in (
|
||||
'rework') and crw.routing_type == 'CNC加工')
|
||||
cnc_rework = max(
|
||||
self.production_id.workorder_ids.filtered(
|
||||
lambda
|
||||
crw: crw.processing_panel == panel.name and crw.state == 'rework' and crw.routing_type == 'CNC加工'),
|
||||
key=lambda w: w.create_date
|
||||
)
|
||||
if cnc_rework.cnc_ids:
|
||||
for item_line in cnc_rework.cnc_ids:
|
||||
vals = {
|
||||
@@ -150,9 +153,10 @@ class ReworkWizard(models.TransientModel):
|
||||
p: p.routing_type == '装夹预调' and p.processing_panel == panel.name and p.state not in (
|
||||
'rework', 'done'))
|
||||
if new_pre_workorder:
|
||||
pre_rework = self.production_id.workorder_ids.filtered(
|
||||
pre_rework = max(self.production_id.workorder_ids.filtered(
|
||||
lambda pr: pr.processing_panel == panel.name and pr.state in (
|
||||
'rework') and pr.routing_type == '装夹预调')
|
||||
'rework') and pr.routing_type == '装夹预调'),
|
||||
key=lambda w1: w1.create_date)
|
||||
new_pre_workorder.write(
|
||||
{'processing_drawing': pre_rework.processing_drawing})
|
||||
self.production_id.write({'state': 'progress', 'is_rework': False})
|
||||
@@ -171,7 +175,8 @@ class ReworkWizard(models.TransientModel):
|
||||
('programming_state', '=', '已编程未下发')])
|
||||
if productions_not_delivered:
|
||||
productions_not_delivered.write(
|
||||
{'programming_state': '已编程', 'work_state': '已编程', 'is_rework': False})
|
||||
{'state': 'progress', 'programming_state': '已编程', 'work_state': '已编程',
|
||||
'is_rework': False})
|
||||
|
||||
@api.onchange('production_id')
|
||||
def onchange_processing_panel_id(self):
|
||||
|
||||
Reference in New Issue
Block a user