From 5bb8d068ac0b11b33225e81f12ed67da7ba6da0e Mon Sep 17 00:00:00 2001
From: Nicolas Martinelli <nim@odoo.com>
Date: Sun, 20 Oct 2019 09:38:16 +0000
Subject: [PATCH] [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>
---
 addons/account/wizard/account_move_reversal.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/account/wizard/account_move_reversal.py b/addons/account/wizard/account_move_reversal.py
index 68f5a8ef82d5..63208d6469b6 100644
--- a/addons/account/wizard/account_move_reversal.py
+++ b/addons/account/wizard/account_move_reversal.py
@@ -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.
-- 
GitLab