子制造订单回退功能处理 处理解除装夹没有回退按钮
This commit is contained in:
@@ -91,7 +91,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
('state', '!=', 'cancel')
|
||||
])
|
||||
finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None)
|
||||
if not finish_move and not cur_workorder.is_subcontract:
|
||||
if not finish_move and not cur_workorder.is_subcontract and not cur_workorder.name =='解除装夹':
|
||||
record.back_button_display = True
|
||||
else:
|
||||
record.back_button_display = any(
|
||||
@@ -107,11 +107,11 @@ class ResMrpWorkOrder(models.Model):
|
||||
else:
|
||||
next_workorder = sorted_workorders[position + 1]
|
||||
next_state = next_workorder.state
|
||||
if ((next_state == 'ready' and not next_workorder.is_subcontract) or (next_workorder.state == 'pending' and next_workorder.is_subcontract)) and cur_workorder.state == 'done':
|
||||
if ((next_state == 'ready' and not next_workorder.is_subcontract and not next_workorder.name =='解除装夹') or (next_workorder.state == 'pending' and next_workorder.is_subcontract and not next_workorder.name =='解除装夹')) and cur_workorder.state == 'done':
|
||||
record.back_button_display = True
|
||||
else:
|
||||
record.back_button_display = False
|
||||
if cur_workorder.is_subcontract:
|
||||
if cur_workorder.is_subcontract or cur_workorder.name =='解除装夹':
|
||||
record.back_button_display = False
|
||||
date_planned_start = fields.Datetime(tracking=True)
|
||||
|
||||
@@ -155,14 +155,12 @@ class ResMrpWorkOrder(models.Model):
|
||||
):
|
||||
raise UserError('已入库,无法回退')
|
||||
else:
|
||||
move_finished = cur_workorder.production_id.move_finished_ids
|
||||
random_element = random.choice(move_finished)
|
||||
moves = self.env['stock.move'].search([
|
||||
('name', '=', random_element.name),
|
||||
('name', '=', cur_workorder.production_id.name),
|
||||
('state', '!=', 'cancel')
|
||||
])
|
||||
move_lines = self.env['stock.move.line'].search([
|
||||
('reference', '=', random_element.name),
|
||||
('reference', '=', cur_workorder.production_id.name),
|
||||
('state', '!=', 'cancel')
|
||||
])
|
||||
moves.state = 'assigned'
|
||||
|
||||
Reference in New Issue
Block a user