From fd8ec5001dc1f72f24b3d6bca1789778bfb9a728 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Wed, 26 Jul 2023 06:09:13 +0000 Subject: [PATCH] [FIX] tests: reset sequence at the end of test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some test may perform a request without being in test_mode In this case, a check signaling could be called and since the sequence was incremented the registry may be reloaded. This is a simple fix to avoid this issue waiting for a stronger check. closes odoo/odoo#129814 X-original-commit: 41bb17b3046e8f1605d6f893ca1807d77ed21173 Signed-off-by: Xavier Dollé (xdo) --- addons/account/tests/test_early_payment_discount.py | 2 ++ odoo/tests/common.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/tests/test_early_payment_discount.py b/addons/account/tests/test_early_payment_discount.py index 574efb2355c..e91073bdfa3 100644 --- a/addons/account/tests/test_early_payment_discount.py +++ b/addons/account/tests/test_early_payment_discount.py @@ -66,6 +66,8 @@ class TestAccountEarlyPaymentDiscount(AccountTestInvoicingCommon): Ensure that an invoice with an early discount payment term and no invoice date can be previewed or printed. """ + self.registry.enter_test_mode(self.cr) + self.addCleanup(self.registry.leave_test_mode) out_invoice = self.env['account.move'].create([{ 'move_type': 'out_invoice', 'invoice_payment_term_id': self.early_pay_10_percents_10_days.id, diff --git a/odoo/tests/common.py b/odoo/tests/common.py index d70fef9337c..a52c017f13f 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -750,9 +750,9 @@ class TransactionCase(BaseCase): with cls.registry.cursor() as cr: cls.registry.setup_models(cr) cls.registry.registry_invalidated = False + cls.registry.registry_sequence = cls.registry_start_sequence cls.registry.clear_all_caches() cls.registry.cache_invalidated.clear() - cls.addClassCleanup(reset_changes) cls.cr = cls.registry.cursor()