[FIX] tests: reset sequence at the end of test

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) <xdo@odoo.com>
This commit is contained in:
Xavier-Do
2023-07-27 03:50:53 +02:00
parent 8bdb52c26d
commit fd8ec5001d
2 changed files with 3 additions and 1 deletions
@@ -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,
+1 -1
View File
@@ -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()