Merge pull request #35521 from frappe/mergify/bp/version-14-hotfix/pr-35518

fix:higher precision causes ERR to misjudge zero bal acc as non-zero (backport #35518)
This commit is contained in:
ruthra kumar
2023-06-01 15:39:50 +05:30
committed by GitHub

View File

@@ -12,6 +12,7 @@ from frappe.utils import flt, get_link_to_form
import erpnext
from erpnext.accounts.doctype.journal_entry.journal_entry import get_balance_on
from erpnext.accounts.utils import get_currency_precision
from erpnext.setup.utils import get_exchange_rate
@@ -170,6 +171,15 @@ class ExchangeRateRevaluation(Document):
.run(as_dict=True)
)
# round off balance based on currency precision
currency_precision = get_currency_precision()
for acc in account_details:
acc.balance_in_account_currency = flt(acc.balance_in_account_currency, currency_precision)
acc.balance = flt(acc.balance, currency_precision)
acc.zero_balance = (
True if (acc.balance == 0 or acc.balance_in_account_currency == 0) else False
)
return account_details
@staticmethod