From 765a3bf23f1d9e41e1e8be0a53a77908dd951f7c Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 5 Sep 2018 13:07:13 +0200 Subject: [PATCH] [FIX] account: unreconcile cash basis - Set up a tax as 'Based on Payment' - Create an invoice at date D with this tax - Pay the invoice at date D+1 - Unreconcile A reversal entry is made at the current date, while it should be at the payment date D+1. We make sure to use the payment date only if the payment period has not been locked. Fixes #25738 opw-1870467 --- addons/account/models/account_move.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 7ad166b12e1..67ec719a655 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1884,8 +1884,11 @@ class AccountPartialReconcile(models.Model): if rec.full_reconcile_id: full_to_unlink |= rec.full_reconcile_id #reverse the tax basis move created at the reconciliation time - move = self.env['account.move'].search([('tax_cash_basis_rec_id', 'in', self._ids)]) - move.reverse_moves() + for move in self.env['account.move'].search([('tax_cash_basis_rec_id', 'in', self._ids)]): + if move.date > (move.company_id.period_lock_date or '0000-00-00'): + move.reverse_moves(date=move.date) + else: + move.reverse_moves() res = super(AccountPartialReconcile, self).unlink() if full_to_unlink: full_to_unlink.unlink()