From f7e74e7fa12387c36e2072eb2e21b2e3564965e7 Mon Sep 17 00:00:00 2001 From: Juan Jose Scarafia Date: Tue, 4 Jan 2022 10:43:39 +0000 Subject: [PATCH] [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) --- addons/sale/models/product_template.py | 4 ++-- addons/website_sale/models/product_template.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/sale/models/product_template.py b/addons/sale/models/product_template.py index c14bf0b3625..2bfc5c9c543 100644 --- a/addons/sale/models/product_template.py +++ b/addons/sale/models/product_template.py @@ -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: diff --git a/addons/website_sale/models/product_template.py b/addons/website_sale/models/product_template.py index 150255a9882..94029866d18 100644 --- a/addons/website_sale/models/product_template.py +++ b/addons/website_sale/models/product_template.py @@ -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