-
- Downloads
[FIX] account: correct cash basis rounding in multicurrency
// CASE 1: payment with different rate 1) Setup a company in USD, with EUR activated as well 2) Set a rate of 1 EUR = 2 USD for date A, and 1 EUR = 3 USD for date B 3) Setup a Cash basis tax of 1/3, with a non-reconcilable cash basis transition account 4) At date A, create an invoice with just one line with base amount=99.99 EUR ; and using the tax setup in point 3). 5) Register a full payment for this invoice at date B ===> The exchange move created by the full reconciliation consists of cash basis rounding lines for the CABA base received, transition account and tax account. 99.99 USD for the base, and 33.33 USD for the tax. Those are introduced to bring back the total amount in domestic currency to the domestic amounts computed for the invoice at date A. Impacting the tax account and base received account is totally wrong. When doing cash basis, we want to use the rate of the payment in the amounts that get reported, as it corresponds to the money that actually came in. So, none of the lines impacting those accounts should be there. Only the line impacting the cash basis transition account is useful, to bring its value back to 0. But it actually corresponds to an exchange difference, and we need to balance it with an exchange gain/loss account. This account can already be set as reconcilable, and if so, will be auto-reconciled. We now choose to only rely on that behavior. The account will not be brought to 0 in domestic currency if it's not reoncilable. If it is, it will create a regular exchange difference entry to handle this case properly. // CASE 2: multiple payments in foreign currency, at different rates 1) Setup a company in USD, with EUR activated as well 2) Set a rate of 1 EUR = 3 USD for date A, and 1 EUR = 2 USD for date B and 5 EUR = 1 USD for date C 3) Setup a Cash basis tax of 1/3, with a non-reconcilable cash basis transition account 4) At date A, create an invoice with just one line with base amount=99.99 EUR ; and using the tax setup in point 3). 5) Pay 66.66 EUR at date B 6) Make a second payment of 66.66 EUR at date C ===> The problem in this case is that the tax and base amounts in foreign currency (33.33 and 99.99 EUR) will need to be divided by 2 (because we're making 2 payments, hence 2 cash basis entries), and the currency rounding will round these values to 50.0 for the base (instead of 49.995) and 16.67 (instead of 16,665) for the tax. Summing the cash basis moves will hence give a total base of 100, and tax of 33,34, which is wrong. To handle this, a cash basis rounding of 0.01 EUR needs to be done in the exchange difference entry. The corresponding amount in domestic currency must be computed using the rate of the most recent payment, so it will be 0.05 USD here. Before this commit, this case behaved as the first one, and brought back the reported amount to the rate of the invoice. Moreover, since it never adjusted the amount in foreign currency, the transition account could not be fully reconciled. // FIX To handle both those cases, we now split the behavior of the CABA adjustment: - For rounding errors: we now check the foreign currency amount, and adjust it if necessary, reusing the rate of the most recent payment. If there is no foreign currency, the adjustement is still done for domestic currency, of course. - Exchange rate difference of the transition account is not handled there anymore: to do this, the transition account must be reconcilable. In case of rounding error to compensate for, the adjustment line added in the exchange difference entry will be reconciled with the one on the CABA entries and on the invoice, to reach full reconciliation. In case a transition account is not reconcilable, we only create rounding adjustments, no exchange difference. closes odoo/odoo#106274 X-original-commit: aeb231e8e023b8e0590b57bd139ec379e6de7c25 Signed-off-by:Laurent Smet <las@odoo.com> Signed-off-by:
Olivier Colson (oco) <oco@odoo.com>
Showing
- addons/account/i18n/account.pot 6 additions, 0 deletionsaddons/account/i18n/account.pot
- addons/account/models/account_move_line.py 80 additions, 30 deletionsaddons/account/models/account_move_line.py
- addons/account/tests/test_account_move_reconcile.py 272 additions, 62 deletionsaddons/account/tests/test_account_move_reconcile.py
This diff is collapsed.
Please register or sign in to comment