[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) <vfe@odoo.com>
This commit is contained in:
Louis (loti)
2024-04-11 09:50:50 +00:00
parent 704b5b250f
commit a9e99bd779
@@ -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)