From f9cca591bb911aeb089f8a7fe9ca236279cfc90d Mon Sep 17 00:00:00 2001 From: "jinling.yang" Date: Sat, 18 May 2024 19:52:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A1=A8=E9=9D=A2=E5=B7=A5?= =?UTF-8?q?=E8=89=BA=E5=B7=A5=E5=8D=95=E5=AE=8C=E6=88=90=E6=97=B6=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E5=BA=93=E5=AD=98(stock.move)=E7=9A=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=BA=E5=AE=8C=E6=88=90=E5=B9=B6=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E5=AE=8C=E6=88=90=E6=96=B9=E6=B3=95=E7=9A=84?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 3 ++- sf_manufacturing/models/mrp_workorder.py | 6 ++++++ sf_sale/views/sale_order_view.xml | 5 +---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index bc1d5eef..fc4ccbeb 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -500,7 +500,8 @@ class MrpProduction(models.Model): # 修改标记已完成方法 def button_mark_done1(self): - self._button_mark_done_sanity_checks() + if not self.workorder_ids.filtered(lambda w: w.routing_type not in ['表面工艺']): + self._button_mark_done_sanity_checks() if not self.env.context.get('button_mark_done_production_ids'): self = self.with_context(button_mark_done_production_ids=self.ids) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index dee1258a..91200885 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -907,6 +907,12 @@ class ResMrpWorkOrder(models.Model): move_raw_id.quantity_done = move_raw_id.product_uom_qty record.process_state = '已完工' record.production_id.process_state = '已完工' + if record.routing_type in ['表面工艺']: + raw_move = self.env['stock.move'].sudo().search( + [('origin', '=', record.production_id.name), ('procure_method', '=', 'make_to_order'), + ('state', '!=', 'done')]) + if raw_move: + raw_move.write({'state': 'done'}) record.production_id.button_mark_done1() # self.production_id.state = 'done' diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml index afa718c6..0981ff59 100644 --- a/sf_sale/views/sale_order_view.xml +++ b/sf_sale/views/sale_order_view.xml @@ -81,12 +81,9 @@ -