Skip to content
Snippets Groups Projects
Commit 2003d46e authored by arsi's avatar arsi
Browse files

[FIX] account: compute bills to pay sum based on amount_residual_signed


In case the journal currency is set on the company currency, we should
compute the 'Bills to Pay' sum on amount_residual_signed as it is
the residual amount in the company currency.
In the current state, you can have differences between the sum in the
dashboard and the sum showed in the list view from the 'Bills To Pay'
button.

Steps to reproduce (clean db with accounting):
-Set a foreign currency with 2 different rates (significant if you want
 to see the issue clearly).
-Create an invoice in a sale/purchase journal which has no currency set
 (like Vendor Bills), with the foreign currency and with an invoice_date
  corresponding to one of the rate.
-Register a payment for that invoice, with a date corresponding to the
 other rate and having an amount lower (like half) than the invoice, so
 the invoice is partially reconciled.
-> Go to the accounting dashboard, the amount next to 'Bills to Pay' is
different than the amount (the sum of the column 'Amount Due') in the
list view generated after clicking that button.

These two values should be the same.  They are currently different
because the dashboard takes the amount_residual, which is expressed in
the invoice currency, and apply the exchange rate to get the residual in
the journal currency.
But if the target currency is the company currency, the field
amount_residual_signed is already the residual amount in the company
currency. Unfortunately, in case of partial reconciliation, it is not
always equal to amount_residual expressed in the company currency
anymore. Because amount_residual and amount_residual_signed are
substracted by the payment amount, expressed in each currency, using the
payment date exchange rate.

opw-3184567

closes odoo/odoo#114603

Related: odoo/enterprise#42018
Signed-off-by: default avatarWilliam André (wan) <wan@odoo.com>
parent 5130765d
No related branches found
No related tags found
No related merge requests found
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