From b87a07c501bdfe331a9598ec833f2332531aa992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Wed, 13 Feb 2019 16:26:03 +0000 Subject: [PATCH] [FIX] product: fix speed of _set_product_template_value_ids compute The method was doing an unnecessary sort since the _order has been fixed in f8dad1bb4b712d8f34035420ef1f6e484c638f5b Moreover, it tried to find the ptav through the attribute_id related field and a map on the other side, instead of directly relying on the ids of the ptv. opw-1923999 task-1922055 PR: #30274 --- addons/product/models/product_attribute.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/product/models/product_attribute.py b/addons/product/models/product_attribute.py index ed1f70b4bc4..3891af446d7 100644 --- a/addons/product/models/product_attribute.py +++ b/addons/product/models/product_attribute.py @@ -136,8 +136,8 @@ class ProductTemplateAttributeLine(models.Model): for product_template_attribute_line in self: product_template_attribute_line.product_template_value_ids = self.env['product.template.attribute.value'].search([ ('product_tmpl_id', 'in', product_template_attribute_line.product_tmpl_id.ids), - ('product_attribute_value_id.attribute_id', 'in', product_template_attribute_line.value_ids.mapped('attribute_id').ids)] - ).sorted(lambda product_product_attribute: product_product_attribute.sequence) + ('product_attribute_value_id', 'in', product_template_attribute_line.value_ids.ids)] + ) @api.multi def unlink(self):