Skip to content
Snippets Groups Projects
Commit 07d5735d authored by Laurent Smet's avatar Laurent Smet
Browse files

[FIX] account: Fix reversal of exchange diff entry when unlinking the full reconcile


Suppose an invoice of 1200USD = 3600EUR reconciled with a payment 1800USD = 3600EUR.

The generated exchange difference journal entry is:
600USD = 0EUR because 1800 - 1200 - 600 = 0 and 3600 - 3600 = 0
=> Everything is reconciled and all residual amounts are 0.

Remove the reconciliation. The exchange difference entry is reversed in other to cancel it.
Because the current exchange difference entry contains a line of 600USD, the reversal is creating a line of -600USD.

Before this commit:

Because both lines were sharing the same foreign currency (EUR) but have an amount_residual_currency of 0, no partial was created and then, a new exchange difference was generated in order to fix the amount_residual of 600 in USD.

After this commit:

A partial is created to handle the residual amount in USD even the residual amount in foreign currency is already zero.

Note: this issue is also there when the reconciliation is made using the company's currency with different foreign currencies.
In that case, amount_residual is zero but not amount_residual_currency.

closes odoo/odoo#66653

Opw: 2450699
Signed-off-by: default avataroco-odoo <oco-odoo@users.noreply.github.com>
parent 280df5ac
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment