diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 958a1209830..2d295b6e1dc 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -4121,7 +4121,7 @@ class AccountMove(models.Model): ('mode', '=', 'done'), '&', ('mode', '=', 'invoice_single'), - ('create_date', '<=', fields.Date.context_today(self) - relativedelta(days=1)), + ('create_date', '<=', fields.Datetime.now() - relativedelta(hours=24)), ]).unlink() # Process. diff --git a/addons/account/tests/test_account_move_send.py b/addons/account/tests/test_account_move_send.py index 850ab19d246..ee1b4e2c3d3 100644 --- a/addons/account/tests/test_account_move_send.py +++ b/addons/account/tests/test_account_move_send.py @@ -854,7 +854,7 @@ class TestAccountMoveSend(TestAccountMoveSendCommon): self.assertTrue(wizard.exists()) # If cron is triggered one day or later than the creation it should be garbage collected. - with freeze_time(fields.Date.today() + relativedelta(days=1)): + with freeze_time(fields.Datetime.now() + relativedelta(hours=24)): self.env.ref('account.ir_cron_account_move_send').method_direct_trigger() self.assertFalse(wizard.exists())