From 9f1514bd1475a938af8979d240ccaa323c1fef19 Mon Sep 17 00:00:00 2001 From: guanhuan Date: Mon, 6 Jan 2025 11:44:33 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=80=E5=94=AE?= =?UTF-8?q?=E5=8D=95=E5=8F=B7=E5=92=8C=E8=BF=BD=E6=BA=AF=E5=8F=82=E8=80=83?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/stock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index fa723283..72581d8c 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -605,10 +605,10 @@ class StockPicking(models.Model): sale_info = self.env['sale.order'].sudo().search( [('name', '=', sale_name)]) else: - production_list = self.env['mrp.production'].sudo().search( + sale_order_line = self.env['sale.order.line'].sudo().search( [('product_id', '=', product_id.id)]) - if production_list: - sale_info = production_list[0].sale_order_id + if sale_order_line: + sale_info = sale_order_line[0].order_id if sale_info: item.sale_order_id = sale_info.id item.retrospect_ref = sale_info.order_code From 0bd65b5da8fd3a860fad21f76bfe7c71a49baf05 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Mon, 6 Jan 2025 13:03:15 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 26 ++++++++---------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 447c6da1..6cb177dc 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1058,18 +1058,16 @@ class ResMrpWorkOrder(models.Model): and workorder.production_id.schedule_state == '已排' and len(workorder.production_id.picking_ids.filtered( lambda w: w.state not in ['done', 'cancel'])) == 0): - workorder.state = 'ready' if workorder.is_subcontract is True: purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id.state == 'purchase': - move_out = workorder.move_subcontract_workorder_ids[1] - for mo in move_out: - if mo.state != 'done': - mo.write({'state': 'assigned', 'production_id': False}) + workorder.state = 'ready' continue - continue - else: - workorder.state = 'waiting' + else: + workorder.state = 'waiting' + continue + else: + workorder.state = 'ready' continue # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' @@ -1093,17 +1091,11 @@ class ResMrpWorkOrder(models.Model): if workorder.is_subcontract is False: workorder.state = 'ready' else: - if len(workorder.production_id.picking_ids.filtered( - lambda w: w.state not in ['done', - 'cancel'])) == 0 and workorder.production_id.programming_state == '已编程': - workorder.state = 'ready' purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id: - if purchase_orders_id.state == 'purchase': - move_out = workorder.move_subcontract_workorder_ids[1] - for mo in move_out: - if mo.state != 'done': - mo.write({'state': 'assigned', 'production_id': False}) + workorder.state = 'ready' if purchase_orders_id.state == 'purchase' else 'waiting' + else: + workorder.state = 'waiting' # 重写工单开始按钮方法 def button_start(self): From bc475441a2e572cef85b4e1103dd33b696a8729c Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Mon, 6 Jan 2025 13:11:22 +0800 Subject: [PATCH 3/6] =?UTF-8?q?1=E3=80=81=E5=8E=BB=E9=99=A4=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E5=BC=80=E5=A7=8B=E6=8C=89=E9=92=AE=E7=9A=84=E4=BA=8C?= =?UTF-8?q?=E6=AC=A1=E7=A1=AE=E8=AE=A4=EF=BC=9B2=E3=80=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=89=98=E7=9B=98=E5=85=A5=E5=BA=93=E5=90=8E=E5=A4=B9?= =?UTF-8?q?=E5=85=B7=E7=89=A9=E6=96=99=E6=9F=A5=E8=AF=A2=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=BF=98=E6=98=AF=E6=9C=AA=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 26 ++++++++++++------- sf_manufacturing/views/mrp_workorder_view.xml | 2 +- .../models/maintenance_equipment.py | 4 +++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 6cb177dc..447c6da1 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1058,16 +1058,18 @@ class ResMrpWorkOrder(models.Model): and workorder.production_id.schedule_state == '已排' and len(workorder.production_id.picking_ids.filtered( lambda w: w.state not in ['done', 'cancel'])) == 0): + workorder.state = 'ready' if workorder.is_subcontract is True: purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id.state == 'purchase': - workorder.state = 'ready' + move_out = workorder.move_subcontract_workorder_ids[1] + for mo in move_out: + if mo.state != 'done': + mo.write({'state': 'assigned', 'production_id': False}) continue - else: - workorder.state = 'waiting' - continue - else: - workorder.state = 'ready' + continue + else: + workorder.state = 'waiting' continue # ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]========================== if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework' @@ -1091,11 +1093,17 @@ class ResMrpWorkOrder(models.Model): if workorder.is_subcontract is False: workorder.state = 'ready' else: + if len(workorder.production_id.picking_ids.filtered( + lambda w: w.state not in ['done', + 'cancel'])) == 0 and workorder.production_id.programming_state == '已编程': + workorder.state = 'ready' purchase_orders_id = self._get_surface_technics_purchase_ids() if purchase_orders_id: - workorder.state = 'ready' if purchase_orders_id.state == 'purchase' else 'waiting' - else: - workorder.state = 'waiting' + if purchase_orders_id.state == 'purchase': + move_out = workorder.move_subcontract_workorder_ids[1] + for mo in move_out: + if mo.state != 'done': + mo.write({'state': 'assigned', 'production_id': False}) # 重写工单开始按钮方法 def button_start(self): diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 1e47b873..d5cba300 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -172,7 +172,7 @@ -