[FIX] payment: test with correct currency rates

Following the standardization of the demo data in
https://github.com/odoo/odoo/commit/3752b3166ec6bbb5c6ea55f96bb521381bf2b2d9,
some bugs remained in case the currency of the company was changed.

closes odoo/odoo#108943

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Valentin Vallaeys (vava)
2023-01-03 13:16:10 +01:00
parent b09f06f986
commit a97922635d
@@ -104,6 +104,11 @@ class TestPaymentProvider(PaymentCommon):
def test_fees_with_currency_conversion(self):
""" Test that the conversion of the fees is correctly computed. """
# Some modules change the company settings and may make this test useless.
if self.currency_euro == self.provider.main_currency_id or (
self.country_france == self.provider.company_id.country_id
):
return
self.provider.write({
'fees_active': True,
'fees_dom_fixed': 0.,
@@ -114,7 +119,7 @@ class TestPaymentProvider(PaymentCommon):
with patch(
'odoo.addons.base.models.res_currency.Currency._get_rates',
return_value={self.currency_euro.id: 2., self.currency_usd.id: 1.},
return_value={self.currency_euro.id: 2., self.provider.main_currency_id.id: 1.},
):
transaction_fees = self.currency.round(
self.provider._compute_fees(self.amount, self.currency_euro, self.country_france)