匹配规则修改

This commit is contained in:
liaodanlong
2025-02-26 10:46:02 +08:00
parent bff10de6b2
commit 85c8e834cb
2 changed files with 3 additions and 2 deletions

View File

@@ -131,7 +131,7 @@ class PurchaseOrderLine(models.Model):
[('name', '=', sale_order_name)])
if sale_order:
filtered_order_line = sale_order.order_line.filtered(
lambda order_line: product_name in order_line.product_id.name
lambda order_line: re.search(f'S{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

View File

@@ -769,8 +769,9 @@ 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: product_name in production.product_id.name
lambda production: re.search(f'S{product_name}$', production.product_id.name)
)
if filtered_order_line:
move.part_number = filtered_order_line.part_number
move.part_name = filtered_order_line.part_name