From 2e648dea4e7143cf2efc94e20c1aadffc3ea3fef Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 25 Feb 2025 16:29:58 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=88=90=E5=93=81=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E5=8D=95=E5=B7=B2=E7=BB=8F=E5=AE=8C=E6=88=90-=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E8=BF=98=E6=9C=89=E3=80=90=E5=9B=9E=E9=80=80=E3=80=91?= =?UTF-8?q?=E6=8C=89=E9=92=AE-=E8=BF=98=E8=83=BD=E5=9B=9E=E9=80=80?= =?UTF-8?q?=E6=88=90=E5=8A=9F=20=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/stock.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 9f5a7733..0156fa81 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -645,6 +645,16 @@ class StockPicking(models.Model): stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel")) if sale_id and not stock_picking: sale_id.write({'state': 'delivered'}) + if self.location_dest_id.name == '成品存货区' and self.state == 'done': + for move in self.move_ids: + for production in self.sale_order_id.mrp_production_ids: + moves = self.env['stock.move'].search([ + ('name', '=', production.name), + ('state', '!=', 'cancel') + ]) + finish_move = next((move for move in moves if move.location_dest_id.name == '制造后'), None) + if finish_move.id in move.move_orig_ids.ids and finish_move.state == 'done': + production.workorder_ids.write({'back_button_display': False}) return res # 创建 外协出库入单 From a0c5f9d15fb38ba5a3a65a6dc7fc6fd115425b21 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 25 Feb 2025 16:31:18 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=B6=E9=80=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=98=AF=E8=BF=94=E5=B7=A5=E7=8A=B6=E6=80=81=E6=97=B6-?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E8=BF=94=E5=B7=A5=E7=9A=84=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E6=9C=89=E3=80=90=E5=9B=9E=E9=80=80=E3=80=91=E5=85=A5=E5=8F=A3?= =?UTF-8?q?-=E8=A6=81=E9=9A=90=E8=97=8F=E9=97=AE=E9=A2=98=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 9a7c949d..f65897d7 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -103,7 +103,11 @@ class ResMrpWorkOrder(models.Model): record.back_button_display = True else: record.back_button_display = False - if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹': + # tag_type + if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹' or any( + detection_result.processing_panel == cur_workorder.processing_panel and detection_result.routing_type == cur_workorder.routing_type and cur_workorder.tag_type !='重新加工' + for detection_result in cur_workorder.production_id.detection_result_ids + ): record.back_button_display = False else: next_workorder = sorted_workorders[position + 1] @@ -113,7 +117,10 @@ class ResMrpWorkOrder(models.Model): record.back_button_display = True else: record.back_button_display = False - if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹': + if cur_workorder.is_subcontract or cur_workorder.name == '解除装夹' or any( + detection_result.processing_panel == cur_workorder.processing_panel and detection_result.routing_type == cur_workorder.routing_type and cur_workorder.tag_type !='重新加工' + for detection_result in cur_workorder.production_id.detection_result_ids + ): record.back_button_display = False date_planned_start = fields.Datetime(tracking=True) From 7975fd2bd29b0bcce6872b2e3d6f818302a08ecf Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 25 Feb 2025 16:32:04 +0800 Subject: [PATCH 3/4] =?UTF-8?q?CNC=E5=9B=9E=E9=80=80=E5=90=8E=E9=9C=80?= =?UTF-8?q?=E5=BC=80=E6=94=BE=E9=80=81=E6=A3=80=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/views/mrp_workorder_view.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index bd94e9c9..ff6b0a20 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -202,10 +202,11 @@ attrs="{'invisible': ['|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked')]}"/>