From a9e99bd7797c17fa92321d187c199d64030ddd7a Mon Sep 17 00:00:00 2001 From: "Louis (loti)" Date: Thu, 11 Apr 2024 09:58:35 +0200 Subject: [PATCH] [FIX] website_sale: fix currency conversion in combination info `compare_list_price` wasn't updated when the user changed the website's currency. Now, it's converted to the website's currency. This change also makes the conversion of `price_extra` and `list_price` safer by fetching both the `from` currency and the `from` amount from the same record. opw-3845887 closes odoo/odoo#161428 Signed-off-by: Victor Feyens (vfe) --- addons/website_sale/models/product_template.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/website_sale/models/product_template.py b/addons/website_sale/models/product_template.py index dfce2b72749..82c97331b00 100644 --- a/addons/website_sale/models/product_template.py +++ b/addons/website_sale/models/product_template.py @@ -461,13 +461,13 @@ class ProductTemplate(models.Model): list_price = product_or_template._price_compute('list_price')[product_or_template.id] price_extra = product_or_template._get_attributes_extra_price() if product_or_template.currency_id != currency: - price_extra = self.currency_id._convert( + price_extra = product_or_template.currency_id._convert( from_amount=price_extra, to_currency=currency, company=self.env.company, date=date, ) - list_price = self.currency_id._convert( + list_price = product_or_template.currency_id._convert( from_amount=list_price, to_currency=currency, company=self.env.company, @@ -475,7 +475,7 @@ class ProductTemplate(models.Model): ) compare_list_price = product_or_template.currency_id._convert( from_amount=compare_list_price, - to_currency=self.currency_id, + to_currency=currency, company=self.env.company, date=date, round=False)