[FW][FIX] (website_)sale: Perf improvement on /shop loading
closes odoo/odoo#83215 Forward-port-of: #81767 X-original-commit: cb19f45ae8180247101cf4aafec2a1fe769772ff Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
committed by
Yannick Tivisse
parent
97f470b949
commit
f7e74e7fa1
@@ -234,7 +234,7 @@ class ProductTemplate(models.Model):
|
||||
price = pricelist._get_product_price(product, quantity)
|
||||
else:
|
||||
price = list_price
|
||||
display_image = bool(product.image_1920)
|
||||
display_image = bool(product.image_128)
|
||||
display_name = product.display_name
|
||||
price_extra = (product.price_extra or 0.0) + (sum(no_variant_attributes_price_extra) or 0.0)
|
||||
else:
|
||||
@@ -246,7 +246,7 @@ class ProductTemplate(models.Model):
|
||||
price = pricelist._get_product_price(product_template, quantity)
|
||||
else:
|
||||
price = list_price
|
||||
display_image = bool(product_template.image_1920)
|
||||
display_image = bool(product_template.image_128)
|
||||
|
||||
combination_name = combination._get_combination_name()
|
||||
if combination_name:
|
||||
|
||||
@@ -234,11 +234,11 @@ class ProductTemplate(models.Model):
|
||||
:rtype: recordset of 'product.template' or recordset of 'product.product'
|
||||
"""
|
||||
self.ensure_one()
|
||||
if self.image_1920:
|
||||
if self.image_128:
|
||||
return self
|
||||
variant = self.env['product.product'].browse(self._get_first_possible_variant_id())
|
||||
# if the variant has no image anyway, spare some queries by using template
|
||||
return variant if variant.image_variant_1920 else self
|
||||
return variant if variant.image_variant_128 else self
|
||||
|
||||
def _get_current_company_fallback(self, **kwargs):
|
||||
"""Override: if a website is set on the product or given, fallback to
|
||||
|
||||
Reference in New Issue
Block a user