From 2e479220865c5e8768b59554c54e8dd92b29707f Mon Sep 17 00:00:00 2001 From: liaodanlong Date: Wed, 26 Feb 2025 11:25:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=B9=E9=85=8D=E8=A7=84=E5=88=99=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/purchase_order.py | 4 ++-- sf_manufacturing/models/stock.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py index d0bf4bf0..b7ec1bc2 100644 --- a/sf_manufacturing/models/purchase_order.py +++ b/sf_manufacturing/models/purchase_order.py @@ -124,14 +124,14 @@ class PurchaseOrderLine(models.Model): if match: product_name = match.group(0) sale_order_name = '' - match_sale = re.search(r'(S\d+)', record.product_id.name) + match_sale = re.search(r'(\d+)', record.product_id.name) if match_sale: sale_order_name = match_sale.group(0) sale_order = self.env['sale.order'].sudo().search( [('name', '=', sale_order_name)]) if sale_order: filtered_order_line = sale_order.order_line.filtered( - lambda order_line: re.search(f'S{product_name}$', order_line.product_id.name) + lambda order_line: re.search(f'{product_name}$', order_line.product_id.name) ) record.part_number = filtered_order_line.product_id.part_number if filtered_order_line else None record.part_name = filtered_order_line.product_id.part_name if filtered_order_line else None diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py index 9cdb0f99..df5d9e0a 100644 --- a/sf_manufacturing/models/stock.py +++ b/sf_manufacturing/models/stock.py @@ -769,7 +769,7 @@ class ReStockMove(models.Model): sale_order = self.env['sale.order'].sudo().search( [('name', '=', sale_order_name)]) filtered_order_line = sale_order.order_line.filtered( - lambda production: re.search(f'S{product_name}$', production.product_id.name) + lambda production: re.search(f'{product_name}$', production.product_id.name) ) if filtered_order_line: