[FIX] account: auto-post date

Tests can fail when they are run at the moment when `fields.Date.today`
is different from `fields.Date.context_today`.

closes odoo/odoo#39079

X-original-commit: 0405f4a35bcad60fd99b1a05ffc8d9774e9a2829
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-10-20 12:27:12 +00:00
committed by fw-bot
parent 2524d78cab
commit 5bb8d068ac
@@ -57,7 +57,7 @@ class AccountMoveReversal(models.TransientModel):
'invoice_date': move.is_invoice(include_receipts=True) and (self.date or move.date) or False,
'journal_id': self.journal_id and self.journal_id.id or move.journal_id.id,
'invoice_payment_term_id': None,
'auto_post': True if self.date > fields.Date.today() else False,
'auto_post': True if self.date > fields.Date.context_today(self) else False,
})
# Handle reverse method.