Skip to content
Snippets Groups Projects
Commit cf6c0af4 authored by Achraf's avatar Achraf
Browse files

[FIX] website_sale: Correct comparison_price in product page

Linked pr https://github.com/odoo/odoo/pull/133484
Comparison price was not converted to currency pricelist, now it's done.

Problem https://github.com/odoo/odoo/pull/133484#issuecomment-1705317420



closes odoo/odoo#134278

Signed-off-by: default avatarAchraf Ben Azzouz (abz) <abz@odoo.com>
parent 8e516dcc
Branches
Tags
No related merge requests found
......@@ -200,6 +200,14 @@ class ProductTemplate(models.Model):
if not price_list_contains_template:
price_reduce = base_sales_prices[template.id]
template_price_vals.update(price_reduce=price_reduce)
if template.currency_id != pricelist.currency_id:
base_price = template.currency_id._convert(
base_price,
pricelist.currency_id,
self.env.company,
fields.Datetime.now(),
round=False
)
elif show_discount and price_list_contains_template:
base_price = base_sales_prices[template.id]
......
......@@ -19,10 +19,10 @@ tour.register('compare_list_price_price_list_display', {
tourUtils.assertProductPrice("price_reduce", "2,000", "test_product_default"),
tourUtils.assertProductPrice("price_reduce", "4,000", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("base_price", "2,500", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("price_reduce", "4,000", "test_product_with_pricelist"),
tourUtils.assertProductPrice("base_price", "5,000", "test_product_with_compare_list_price"),
tourUtils.assertProductPrice("price_reduce", "4,000", "test_product_with_pricelist"),
tourUtils.assertProductPrice("price_reduce", "8,000", "test_product_with_pricelist_and_compare_list_price"),
tourUtils.assertProductPrice("base_price", "4,500", "test_product_with_pricelist_and_compare_list_price"),
tourUtils.assertProductPrice("base_price", "9,000", "test_product_with_pricelist_and_compare_list_price"),
...tourUtils.selectPriceList('pricelist_with_discount'),
......
......@@ -191,7 +191,7 @@
<t t-set="template_price_vals" t-value="get_product_prices(product)"/>
<div class="o_wsale_product_btn"/>
<div class="product_price" itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer">
<t t-if="'base_price' in template_price_vals">
<t t-if="'base_price' in template_price_vals and (template_price_vals['base_price'] &gt; template_price_vals['price_reduce'])">
<del t-attf-class="text-muted me-1 h6 mb-0" style="white-space: nowrap;">
<em class="small" t-esc="template_price_vals['base_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}" />
</del>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment