diff --git a/addons/website_sale/models/product_template.py b/addons/website_sale/models/product_template.py index 9e3b1276358..174e06ee043 100644 --- a/addons/website_sale/models/product_template.py +++ b/addons/website_sale/models/product_template.py @@ -261,6 +261,7 @@ class ProductTemplate(models.Model): sales_prices = pricelist._get_products_price(self, 1.0) show_discount = pricelist and pricelist.discount_policy == 'without_discount' + show_strike_price = self.env.user.has_group('website_sale.group_product_price_comparison') base_sales_prices = self._price_compute('list_price', currency=currency) website = self.env['website'].get_current_website() @@ -279,7 +280,7 @@ class ProductTemplate(models.Model): base_price = None price_list_contains_template = currency.compare_amounts(price_reduce, base_sales_prices[template.id]) != 0 - if template.compare_list_price: + if template.compare_list_price and show_strike_price: # The base_price becomes the compare list price and the price_reduce becomes the price base_price = template.compare_list_price if not price_list_contains_template: diff --git a/addons/website_sale/tests/test_website_sale_show_compare_list_price.py b/addons/website_sale/tests/test_website_sale_show_compare_list_price.py index a448bcaa3a9..ab3312034c9 100644 --- a/addons/website_sale/tests/test_website_sale_show_compare_list_price.py +++ b/addons/website_sale/tests/test_website_sale_show_compare_list_price.py @@ -1,4 +1,8 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo.fields import Command from odoo.tests import tagged + from odoo.addons.account.tests.common import AccountTestInvoicingHttpCommon @@ -112,4 +116,9 @@ class WebsiteSaleShopPriceListCompareListPriceDispayTests(AccountTestInvoicingHt }) def test_compare_list_price_price_list_display(self): + self.env.user.write({ + 'groups_id': [Command.link( + self.env.ref('website_sale.group_product_price_comparison').id + )], + }) self.start_tour("/", 'compare_list_price_price_list_display', login=self.env.user.login)