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: