diff --git a/addons/purchase_product_matrix/models/purchase.py b/addons/purchase_product_matrix/models/purchase.py index 7dfbd4bcc01b8b7312431faf70323aa8c2100532..c38548066b3f3906a0662846637493849bf125cf 100644 --- a/addons/purchase_product_matrix/models/purchase.py +++ b/addons/purchase_product_matrix/models/purchase.py @@ -47,7 +47,7 @@ class PurchaseOrder(models.Model): product = product_template._create_product_variant(combination) # TODO replace the check on product_id by a first check on the ptavs and pnavs? # and only create/require variant after no line has been found ??? - order_lines = self.order_line.filtered(lambda line: line.product_id == product and line.product_no_variant_attribute_value_ids == no_variant_attribute_values) + order_lines = self.order_line.filtered(lambda line: (line._origin or line).product_id == product and (line._origin or line).product_no_variant_attribute_value_ids == no_variant_attribute_values) # if product variant already exist in order lines old_qty = sum(order_lines.mapped('product_qty')) diff --git a/addons/sale_product_matrix/models/sale_order.py b/addons/sale_product_matrix/models/sale_order.py index 963d38f031e97c0babb97a7b201ae2bd715546d8..7c51c641d8859797c13bb720047de90dbb62a7ac 100644 --- a/addons/sale_product_matrix/models/sale_order.py +++ b/addons/sale_product_matrix/models/sale_order.py @@ -55,7 +55,7 @@ class SaleOrder(models.Model): # create or find product variant from combination product = product_template._create_product_variant(combination) - order_lines = self.order_line.filtered(lambda line: line.product_id == product and line.product_no_variant_attribute_value_ids == no_variant_attribute_values) + order_lines = self.order_line.filtered(lambda line: (line._origin or line).product_id == product and (line._origin or line).product_no_variant_attribute_value_ids == no_variant_attribute_values) # if product variant already exist in order lines old_qty = sum(order_lines.mapped('product_uom_qty'))