Vauxoo / odoo

Fork of Odoo (formerly OpenERP). [This project is not publically mantained just born for internal usage with some little patches] go to official repository on github.com/odoo/odoo
https://www.odoo.com
Other
9 stars 9 forks source link

[FIX] Multi-currency reconciliation could fetch values from different records #347

Closed hbto closed 2 years ago

hbto commented 4 years ago

Before

Before this commit when reconciling multi-currency Journal Items with different rates and the amount_residual goes down and the amount_currency_residual goes up as in this example:

Line: amount_residual_currency amount_residual currency rate reconciled
Debit: 1,000.00 20,000.00 USD 20.00 False
Credit: -900.00 -22,500.00 USD 25.00 False

Led to fetch the values as:

And in doing so it was fetching values from two different records. In the case of the payment (Credit) though fully consumed was not being marked as reconciled as depicted here:

Line: amount_residual_currency amount_residual currency rate reconciled
Debit: 100.00 0.00 USD 20.00 False
Credit: 0.00 -2,500.00 USD 25.00 False

This has the effect of leaving both of the lines marked as not reconciled. And account.payment record is kept showing the "smart button".

After

After this commit when reconciling multi-currency Journal Items with different rates and the amount_residual goes down and the amount_currency_residual goes up as in this example:

Line: amount_residual_currency amount_residual currency rate reconciled
Debit: 1,000.00 20,000.00 USD 20.00 False
Credit: -900.00 -22,500.00 USD 25.00 False

The fetched values for the following variables will be like:

As both values are fetched from the same record. In the case of the payment (Credit), it is fully consumed in both fields and it is marked as reconciled as depicted here:

Line: amount_residual_currency amount_residual currency rate reconciled
Debit: 100.00 -2,500.00 USD 20.00 False
Credit: 0.00 0.00 USD 25.00 True

This has the effect of leaving the account.payment record marked as reconciled

Another good side effect is that the carrying exchange difference is transferred to the outstanding value that could later be reconciled as the payment won't be included in the reconciliation any longer.

-- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr