From 2e648dea4e7143cf2efc94e20c1aadffc3ea3fef Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Tue, 25 Feb 2025 16:29:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E5=93=81=E5=85=A5=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=AE=8C=E6=88=90-=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E8=BF=98=E6=9C=89=E3=80=90=E5=9B=9E=E9=80=80=E3=80=91=E6=8C=89?= =?UTF-8?q?=E9=92=AE-=E8=BF=98=E8=83=BD=E5=9B=9E=E9=80=80=E6=88=90?= =?UTF-8?q?=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 # 创建 外协出库入单