-
Notifications
You must be signed in to change notification settings - Fork 7.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Exchange rate revaluation to handle accounts with zero account balance #33165
refactor: Exchange rate revaluation to handle accounts with zero account balance #33165
Conversation
56dc7be
to
ed9df5f
Compare
Codecov Report
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
|
30efb82
to
d07b78a
Compare
6827c04
to
e97667b
Compare
erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
Outdated
Show resolved
Hide resolved
erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
Outdated
Show resolved
Hide resolved
erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
Outdated
Show resolved
Hide resolved
erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
Outdated
Show resolved
Hide resolved
e97667b
to
014f180
Compare
1. Additional check box accounts table to identify accounts with zero balance 2. Accounts with zero balance only in either of the 2 currencies will be handled on separate Journal
014f180
to
8a730dd
Compare
…unt balance (#33165) * refactor: new type for JE - Exchange Gain or Loss * refactor: skip few validations for Exchanage Gain Or Loss type Jour * refactor: ERR create 2 journals for handling zero and non-zero compa 1. Additional check box accounts table to identify accounts with zero balance 2. Accounts with zero balance only in either of the 2 currencies will be handled on separate Journal * refactor: skips few validation for allowing 0 debit/credit * fix: General Ledger presentaion currency * test: fix test case in general ledger * test: fix failing test case in AR report (cherry picked from commit 914b230) # Conflicts: # erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
…unt balance (#33165) * refactor: new type for JE - Exchange Gain or Loss * refactor: skip few validations for Exchanage Gain Or Loss type Jour * refactor: ERR create 2 journals for handling zero and non-zero compa 1. Additional check box accounts table to identify accounts with zero balance 2. Accounts with zero balance only in either of the 2 currencies will be handled on separate Journal * refactor: skips few validation for allowing 0 debit/credit * fix: General Ledger presentaion currency * test: fix test case in general ledger * test: fix failing test case in AR report (cherry picked from commit 914b230)
…unt balance (#33165) refactor: Exchange rate revaluation to handle accounts with zero account balance (#33165) * refactor: new type for JE - Exchange Gain or Loss * refactor: skip few validations for Exchanage Gain Or Loss type Jour * refactor: ERR create 2 journals for handling zero and non-zero compa 1. Additional check box accounts table to identify accounts with zero balance 2. Accounts with zero balance only in either of the 2 currencies will be handled on separate Journal * refactor: skips few validation for allowing 0 debit/credit * fix: General Ledger presentaion currency * test: fix test case in general ledger * test: fix failing test case in AR report (cherry picked from commit 914b230) Co-authored-by: ruthra kumar <ruthra@erpnext.com>
# Handle Accounts with '0' balance in Account/Base Currency | ||
for d in [x for x in account_details if x.zero_balance]: | ||
|
||
# TODO: Set new balance in Base/Account currency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this TODO valid?
I'm trying to find why this is generated a non balanced journal entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's Invalid. Looks like I forgot to remove it.
@ruthra-kumar @deepeshgarg007 is it possible to backport to version-13? |
@mohsinalimat |
…unt balance (frappe#33165) * refactor: new type for JE - Exchange Gain or Loss * refactor: skip few validations for Exchanage Gain Or Loss type Jour * refactor: ERR create 2 journals for handling zero and non-zero compa 1. Additional check box accounts table to identify accounts with zero balance 2. Accounts with zero balance only in either of the 2 currencies will be handled on separate Journal * refactor: skips few validation for allowing 0 debit/credit * fix: General Ledger presentaion currency * test: fix test case in general ledger * test: fix failing test case in AR report
Exchange Rate Revaluation will handle Foreign accounts with zero balance on account currency but has balance on company currency.
Changes in this PR:
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.erpnext/erpnext/accounts/report/utils.py
Line 81 in 66dbf94
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 account 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 currency balance to Exchange Gain/Loss account.

General Ledger:

Company/Base Currency:
Account Currency:
