From e1185aa28b881e95a6a68f07f05337bdfd669766 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Fri, 21 Feb 2025 15:22:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=90=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=9B=9E=E9=80=80=E5=8A=9F=E8=83=BD=E5=A4=84=E7=90=86=20?= =?UTF-8?q?=E5=A4=84=E7=90=86=E8=A7=A3=E9=99=A4=E8=A3=85=E5=A4=B9=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=9B=9E=E9=80=80=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index dfae3d16..0d0c9632 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -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'