[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
f8dad1bb4b
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
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user