+
diff --git a/addons/sale/static/src/js/variant_mixin.js b/addons/sale/static/src/js/variant_mixin.js
index ac072ee58bb..54477fb70b3 100644
--- a/addons/sale/static/src/js/variant_mixin.js
+++ b/addons/sale/static/src/js/variant_mixin.js
@@ -528,7 +528,7 @@ var VariantMixin = {
}
this._toggleDisable($parent, isCombinationPossible);
- if (combination.has_discounted_price) {
+ if (combination.has_discounted_price && !combination.compare_list_price) {
$default_price
.closest('.oe_website_sale')
.addClass("discount");
diff --git a/addons/website_sale/models/product_template.py b/addons/website_sale/models/product_template.py
index 31dda620ed7..48e816520d2 100644
--- a/addons/website_sale/models/product_template.py
+++ b/addons/website_sale/models/product_template.py
@@ -53,9 +53,9 @@ class ProductTemplate(models.Model):
base_unit_price = fields.Monetary("Price Per Unit", currency_field="currency_id", compute="_compute_base_unit_price")
base_unit_name = fields.Char(compute='_compute_base_unit_name', help='Displays the custom unit for the products if defined or the selected unit of measure otherwise.')
- compare_list_price = fields.Float(
+ compare_list_price = fields.Monetary(
'Compare to Price',
- digits='Product Price',
+ currency_field="currency_id",
help="The amount will be displayed strikethroughed on the eCommerce product page")
@api.depends('product_variant_ids', 'product_variant_ids.base_unit_count')
@@ -211,6 +211,22 @@ class ProductTemplate(models.Model):
base_price = taxes.compute_all(base_price, pricelist.currency_id, 1, template, partner_sudo)[
tax_display]
template_price_vals['base_price'] = base_price
+ if base_price > price_reduce:
+ base_price = self.env['account.tax']._fix_tax_included_price_company(
+ base_price, product_taxes, taxes, self.env.company)
+ base_price = taxes.compute_all(base_price, pricelist.currency_id, 1, template, partner_sudo)[tax_display]
+ template_price_vals['base_price'] = base_price
+
+ if template.compare_list_price:
+ template_price_vals['base_price'] = template.compare_list_price
+ if template.currency_id != pricelist.currency_id:
+ template_price_vals['base_price'] = template.currency_id._convert(
+ template.compare_list_price,
+ pricelist.currency_id,
+ self.env.company,
+ fields.Datetime.now(),
+ round=False
+ )
res[template.id] = template_price_vals
@@ -270,6 +286,12 @@ class ProductTemplate(models.Model):
fields.Date.today())
has_discounted_price = pricelist.currency_id.compare_amounts(list_price, price) == 1
prevent_zero_price_sale = not price and current_website.prevent_zero_price_sale
+
+ compare_list_price = self.compare_list_price
+ if self.currency_id != pricelist.currency_id:
+ compare_list_price = self.currency_id._convert(self.compare_list_price, pricelist.currency_id, self.env.company,
+ fields.Datetime.now(), round=False)
+
combination_info.update(
base_unit_name=product.base_unit_name,
base_unit_price=product.base_unit_count and list_price / product.base_unit_count,
@@ -278,6 +300,7 @@ class ProductTemplate(models.Model):
price_extra=price_extra,
has_discounted_price=has_discounted_price,
prevent_zero_price_sale=prevent_zero_price_sale,
+ compare_list_price=compare_list_price,
)
return combination_info
@@ -485,6 +508,7 @@ class ProductTemplate(models.Model):
)
if list_price:
data['list_price'] = list_price
+
if with_image:
data['image_url'] = '/web/image/product.template/%s/image_128' % data['id']
if with_category and categ_ids:
@@ -507,6 +531,10 @@ class ProductTemplate(models.Model):
list_price = self.env['ir.qweb.field.monetary'].value_to_html(
combination_info['list_price'], monetary_options
)
+ if combination_info['compare_list_price']:
+ list_price = self.env['ir.qweb.field.monetary'].value_to_html(
+ combination_info['compare_list_price'], monetary_options
+ )
return price, list_price if combination_info['has_discounted_price'] else None
diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml
index 7d6235f4f75..9f3f80a6963 100644
--- a/addons/website_sale/views/templates.xml
+++ b/addons/website_sale/views/templates.xml
@@ -191,7 +191,7 @@
-
+
@@ -870,7 +870,7 @@
-
+
(
/ )
@@ -1156,17 +1156,19 @@
-
-
-
+
@@ -1177,13 +1179,13 @@
"display_currency": product.currency_id,
}'/>
-
+
+ groups="website_sale.group_product_price_comparison"
+ t-options='{
+ "widget": "monetary",
+ "display_currency": website.currency_id,
+ }'/>
diff --git a/addons/website_sale_comparison/views/website_sale_comparison_template.xml b/addons/website_sale_comparison/views/website_sale_comparison_template.xml
index 8833521483d..66c09c6fc10 100644
--- a/addons/website_sale_comparison/views/website_sale_comparison_template.xml
+++ b/addons/website_sale_comparison/views/website_sale_comparison_template.xml
@@ -100,7 +100,8 @@
Price:
-
+
-
+
+