erpnext
erpnext copied to clipboard
refactor: Exchange rate revaluation to handle accounts with zero account balance
Exchange Rate Revaluation will handle Foreign accounts with zero balance on account currency but has balance on company currency.
Changes in this PR:
- New Journal type
Exchange Gain/Loss
. This type skips validations:validate_debit_and_credit_amount
andset_amounts_in_company_currency
which helps to submit GL's with '0' debit/credit value in either currencies. - https://github.com/frappe/erpnext/blob/66dbf94151ca15d1911b2133f5d05dc3c6593f72/erpnext/accounts/report/utils.py#L81 has been modified to handle GL's from [1].
- Exchange Rate Revaluation will now create 2 Journals.
Discussion thread: https://discuss.erpnext.com/t/how-to-maintain-correct-account-balance-in-multiple-currencies-in-case-of-foreign-bank-account/96839
Solution: https://discuss.erpnext.com/t/how-to-maintain-correct-account-balance-in-multiple-currencies-in-case-of-foreign-bank-account/96839/9?u=ruthra
Conder a scenario where a Foreign currency accounts has balance in company currency but not in account currency. 'HDFC USD - TC' in the below screenshot.
ERR can submit a journal to move only the company balance to Exchange Gain/Loss account.


General Ledger:
Company/Base Currency:
Account Currency:
Codecov Report
Merging #33165 (8a730dd) into develop (4076999) will decrease coverage by
0.05%
. The diff coverage is52.02%
.
Additional details and impacted files
@@ Coverage Diff @@
## develop #33165 +/- ##
===========================================
- Coverage 64.10% 64.04% -0.06%
===========================================
Files 818 818
Lines 58670 58834 +164
===========================================
+ Hits 37609 37681 +72
- Misses 21061 21153 +92
Impacted Files | Coverage Δ | |
---|---|---|
erpnext/accounts/general_ledger.py | 94.31% <0.00%> (-0.72%) |
:arrow_down: |
...ange_rate_revaluation/exchange_rate_revaluation.py | 55.60% <49.34%> (-14.09%) |
:arrow_down: |
...xt/accounts/doctype/journal_entry/journal_entry.py | 68.30% <85.71%> (+0.14%) |
:arrow_up: |
erpnext/accounts/doctype/gl_entry/gl_entry.py | 69.10% <100.00%> (ø) |
|
erpnext/accounts/report/utils.py | 80.59% <100.00%> (-0.57%) |
:arrow_down: |
erpnext/erpnext_integrations/exotel_integration.py | 68.04% <0.00%> (-3.73%) |
:arrow_down: |
erpnext/stock/doctype/stock_entry/stock_entry.py | 82.23% <0.00%> (-0.26%) |
:arrow_down: |
erpnext/stock/doctype/pick_list/pick_list.py | 76.53% <0.00%> (-0.21%) |
:arrow_down: |
erpnext/selling/doctype/sales_order/sales_order.py | 80.10% <0.00%> (-0.18%) |
:arrow_down: |
erpnext/hooks.py | 100.00% <0.00%> (ø) |
|
... and 11 more |
@ruthra-kumar @deepeshgarg007 is it possible to backport to version-13?
@mohsinalimat There are no plans to backport this refactor to v13 at the moment.