[IMP] website_sale: speed up loading of attributes on shop
For 10000 templates, of which around 1000 have variants, with 100 existing attributes and 20 values for each: - Displaying the /shop page takes 0.55s before the commit and 0.49s after. That's a 60ms again, around 10% faster. - The number of queries goes from 113 to 106. - The specific line that is changed goes from 6.3% total request time down to 2.77%, so the line becomes 2.3 times faster. closes odoo/odoo#34213 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -278,7 +278,7 @@ class WebsiteSale(http.Controller):
|
||||
ProductAttribute = request.env['product.attribute']
|
||||
if products:
|
||||
# get all products without limit
|
||||
attributes = ProductAttribute.search([('attribute_line_ids.value_ids', '!=', False), ('attribute_line_ids.product_tmpl_id', 'in', search_product.ids)])
|
||||
attributes = ProductAttribute.search([('product_tmpl_ids', 'in', search_product.ids)])
|
||||
else:
|
||||
attributes = ProductAttribute.browse(attributes_ids)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user