From dd6e8b67077e0ea7a2fc0dfff15c676e45dbd126 Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Thu, 27 Mar 2025 15:21:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_production.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 12ff3eda..971f331e 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -289,10 +289,10 @@ class MrpProduction(models.Model): sale_order_name = match.group(0) sale_order = self.env['sale.order'].sudo().search( [('name', '=', sale_order_name)]) + logging.info("product_name is :%s" % product_name) filtered_order_line = sale_order.order_line.filtered( lambda production: re.search(f'{product_name}$', production.product_id.name) ) - if filtered_order_line: production_id.part_number = filtered_order_line.part_number production_id.part_name = filtered_order_line.part_name From 77744e75d7bd4e15220e28d92020ab6b59f030ea Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Thu, 27 Mar 2025 16:38:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=AD=90=E5=88=B6=E9=80=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=9B=B6=E4=BB=B6=E5=9B=BE=E5=8F=B7=E9=9B=B6=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=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_production.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 971f331e..52c5f463 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -280,8 +280,8 @@ class MrpProduction(models.Model): # 如果匹配成功,提取结果 if match: product_name = match.group(0) - if production_id.picking_id.sale_order_id: - sale_order = production_id.picking_id.sale_order_id + if production_id.sale_order_id: + sale_order = production_id.sale_order_id else: sale_order_name = '' match = re.search(r'(S\d+)', production_id.product_id.name)