-
- Downloads
[IMP] account: foreign currency reconciliation (Exchange diff entries on partials)
* Previously, when reconciling journal items in multi-currencies, the exchange difference entry was created only on the full reconciliation. It will now be created directly at each partial to ensure the ratio between amount_residual_currency and amount_residual is always kept identical. * Also when reconciling two lines, one with a foreign currency and one expressed in company currency, the reconciliation is now made based on the foreign currency. ==== RATIONALE ==== This patch allows to fix the following use cases (among others) 1) When everything is expressed in foreign currency, the reconciliation is made in that currency: Suppose EUR is the foreign currency and USD is the company currency. Reconciling: L1: 120 EUR 60 USD (rate 2:1) L2: 240 EUR 80 USD (rate 3:1) ..leads to a partial of 120 EUR and min(80, 60) = 60 USD After the reconciliation, L1 is fully matched but L2 is still open with 120 EUR but only 20 USD. This is the first problem is the current reconciliation because L2 is supposed to have a rate 3:1 so the residual amount should be 120 / 3 = 40 USD. Since the rate is no longer consistent on L2, the user will probably close the reconciliation by using another line in EUR or will close manually the reconciliation with 20 USD but without any additional exchange difference journal items explaining where this unconsistency comes from. 2) When the current lines are mixing multiple currencies, the reconciliation is made using the company's currency. In some countries like Mexico, Ethiopia or Costa Rica, the customer is free to pay an invoice using the company's currency instead of the foreign one. So, suppose USD is the foreign currency and MXN is the company currency. The invoice is expressed by: L1: 120 USD 60 MXN (rate 2:1) If the customer is paying at a date in which the rate is 3:1, he is free to pay either L2: 120 USD 40 MXN (rate 3:1), either L2: 40 MXN. In the second case, he is expecting the invoice to be fully paid because its paiement is equivalent to 120 USD at the payment date. In Odoo, the second case led to an open balance of 20 MXN and the invoice was not completely paid. Even this situation could be easily fixed by a manual write-off, this makes the Mexican payment EDI very complicated to fullfil correctly because the government is expecting a complete matching between the invoice and the payment. When the customer is paying multiple invoices or the invoices are paid using multiple payments, the currently generated mexican EDI file in Odoo was wrong. ==== REFERENCES ==== Original idea suggested by hbto@vauxoo.com. Thanks for the contribution and patience of the many persons having, at some point, helped on that. github issue: https://github.com/odoo/odoo/issues/37469 closes odoo/odoo#84201 Task: 2669371 Related: odoo/enterprise#24268 Signed-off-by:Quentin De Paoli <qdp@odoo.com>
Showing
- addons/account/models/account_move.py 685 additions, 431 deletionsaddons/account/models/account_move.py
- addons/account/models/account_partial_reconcile.py 21 additions, 7 deletionsaddons/account/models/account_partial_reconcile.py
- addons/account/tests/__init__.py 0 additions, 1 deletionaddons/account/tests/__init__.py
- addons/account/tests/common.py 31 additions, 35 deletionsaddons/account/tests/common.py
- addons/account/tests/test_account_move_payments_widget.py 4 additions, 40 deletionsaddons/account/tests/test_account_move_payments_widget.py
- addons/account/tests/test_account_move_reconcile.py 1827 additions, 747 deletionsaddons/account/tests/test_account_move_reconcile.py
- addons/account/tests/test_account_payment_register.py 54 additions, 2 deletionsaddons/account/tests/test_account_payment_register.py
- addons/account/tests/test_reconciliation.py 0 additions, 1208 deletionsaddons/account/tests/test_reconciliation.py
- addons/account/wizard/account_payment_register.py 59 additions, 14 deletionsaddons/account/wizard/account_payment_register.py
- addons/account_check_printing/tests/test_print_check.py 2 additions, 2 deletionsaddons/account_check_printing/tests/test_print_check.py
- addons/purchase_stock/tests/test_stockvaluation.py 46 additions, 99 deletionsaddons/purchase_stock/tests/test_stockvaluation.py
- odoo/addons/base/models/res_currency.py 4 additions, 1 deletionodoo/addons/base/models/res_currency.py
Loading
Please register or sign in to comment