[FIX] account: wrong date method in account_move_send cron
Switch to a datetime to avoid a wizard that has been created at 00:00 to be deleted one minute later. closes odoo/odoo#137697 X-original-commit: 128e3da4807acbc2275c7e4db3833ce062afae24 Signed-off-by: Laurent Smet (las) <las@odoo.com> Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user