fix: Re-organise code

This commit is contained in:
Suraj Shetty 2019-08-13 12:08:49 +05:30
parent 1a2600c9ea
commit 64a962ce97

View File

@ -763,13 +763,14 @@ def get_account_details(account, date, cost_center=None):
'name': account
}, reference_doctype='Payment Entry', limit=1)
account_balance = get_balance_on(account, date, cost_center=cost_center, ignore_account_permission=True)
# There might be some user permissions which will allow account under certain doctypes
# except for Payment Entry, only in such case we should throw permission error
if not account_list:
frappe.throw(_('Account: {0} is not permitted under Payment Entry').format(account))
account_balance = get_balance_on(account, date, cost_center=cost_center,
ignore_account_permission=True)
return frappe._dict({
"account_currency": get_account_currency(account),
"account_balance": account_balance,