Skip to content
Snippets Groups Projects
Commit 8b743ba3 authored by Guillaume (guva)'s avatar Guillaume (guva)
Browse files

[FIX] account: reconciliation on reversed move


With this commit, we make sure that all lines are fully reconciled when
reversing a move.

Steps to reproduce:

- Create a Journal Entry, with eg a line with 300$ debit/credit and two others
lines to make the journal entry fully balanced

|   Account   |   Partner   |   Debit   |   Credit   |
|-------------|-------------|-----------|------------|
|  Account X  |             |   300.0   |     0.0    |
|  Account Y  |  partner A  |     0.0   |   100.0    |
|  Account Y  |  partner B  |     0.0   |   200.0    |

- Then reverse the move
-> Only one line is marked as fully reconciled, the other one is marked
as partially reconciled.

This is because each line was passed in the reconcile method with
all the counterpart lines, even those which didn't belong to it.
Therefore, all the firsts lines was marked as partially reconciled
until the last one, which passed with the only counterpart line
left.

With this commit, we group the lines and counterpart lines by account,
and reconcile them.

This is a correction of this commit 6481eb72
which introduced a bug in l10n_mx, when unreconciling moves with tax 0%,
here are the steps to reproduce this bug:

- With l10n_mx installed
- Create an invoice with tax 0%
- Confirm and register payment
- Try to unreconcile the payment
-> We get an UserError : "You are trying to reconcile some entries that
  are already reconciled"

This happened because in the first fix, we didn't filtered the already
reconciled moves. Also, it's reproductible in 15 but change is made here
in order to keep consistency between versions.

opw-2810392
opw-2851999

closes odoo/odoo#92446

X-original-commit: 869ed09c
Signed-off-by: default avatarWilliam André (wan) <wan@odoo.com>
Signed-off-by: default avatarGuillaume Vanleynseele <guva@odoo.com>
parent da11c4cd
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment