[FIX] base: cron indeterministic test

Upon calling `invalidate_recordset` the current recordset present is
flushed. That recordset can be active=True which override active=False
set `_process_job()`. Flushing the recordset *before* calling
`_process_job` makes sure that there is no dangling data to be flushed.

closes odoo/odoo#159262

Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
This commit is contained in:
Julien Castiaux
2024-03-26 15:40:32 +00:00
parent e114934423
commit bfc62bc3ef
+1
View File
@@ -263,6 +263,7 @@ class TestIrCron(TransactionCase, CronMixinCase):
def test_cron_null_interval(self):
self.cron.interval_number = 0
self.cron.flush_recordset()
with self.assertLogs('odoo.addons.base.models.ir_cron', 'ERROR'):
self.cron._process_job(get_db_name(), self.env.cr, self.cron.read(load=False)[0])
self.cron.invalidate_recordset(['active'])