From 67b08e5c42436eb8bac7e4f776d032530f9e9772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Wed, 26 Feb 2025 08:52:56 +0100 Subject: [PATCH] [FIX] account_invoice_report_due_list: Define the right rate for the currency in test In some cases (when installing some modules), the rate of the currency is different than expected, therefore, we remove the existing values and define the expected rate to validate the appropriate values. --- .../tests/test_invoice_report_due_list.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/account_invoice_report_due_list/tests/test_invoice_report_due_list.py b/account_invoice_report_due_list/tests/test_invoice_report_due_list.py index acb3c8fd3..a23c03773 100644 --- a/account_invoice_report_due_list/tests/test_invoice_report_due_list.py +++ b/account_invoice_report_due_list/tests/test_invoice_report_due_list.py @@ -9,7 +9,7 @@ from odoo import fields from odoo.tests import common, tagged from odoo.tests.common import Form -from odoo.tools import posix_to_ldml, pycompat +from odoo.tools import mute_logger, posix_to_ldml, pycompat @tagged("post_install", "-at_install") @@ -108,7 +108,19 @@ def test_due_list(self, move_type="out_invoice"): self.assertRegex(str(res[0]), date_due_format) self.assertRegex(str(res[0]), "75.0") + @mute_logger("odoo.models.unlink") def test_due_list_currency_extra(self, move_type="out_invoice"): + # We leave the rate of the extra currency at 1 so that the amounts to be + # checked are as expected. + self.env["res.currency.rate"].search( + [("currency_id", "=", self.currency_extra.id)] + ).unlink() + self.env["res.currency.rate"].create( + { + "currency_id": self.currency_extra.id, + "rate": 2, + } + ) move_form2 = Form( self.env["account.move"].with_context(default_move_type=move_type) ) @@ -120,4 +132,4 @@ def test_due_list_currency_extra(self, move_type="out_invoice"): line_form2.price_unit = 200.0 invoice2 = move_form2.save() invoice2.action_post() - self.assertEqual(invoice2.get_multi_due_list()[0][2], 50.0) + self.assertEqual(invoice2.get_multi_due_list()[0][2], 25.0)