[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
This commit is contained in:
Nicolas Martinelli
2018-09-06 14:45:40 +02:00
committed by Nicolas Martinelli
parent 89c1555096
commit 765a3bf23f
+5 -2
View File
@@ -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()