fix: Ignore account permission check
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 3e1bd62..2f1efa5 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -763,12 +763,16 @@
'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))
return frappe._dict({
"account_currency": get_account_currency(account),
- "account_balance": get_balance_on(account, date, cost_center=cost_center),
+ "account_balance": account_balance,
"account_type": frappe.db.get_value("Account", account, "account_type")
})
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index e1ed642..ac69fd3 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -84,7 +84,8 @@
throw(_("{0} '{1}' not in Fiscal Year {2}").format(label, formatdate(date), fiscal_year))
@frappe.whitelist()
-def get_balance_on(account=None, date=None, party_type=None, party=None, company=None, in_account_currency=True, cost_center=None):
+def get_balance_on(account=None, date=None, party_type=None, party=None, company=None,
+ in_account_currency=True, cost_center=None, ignore_account_permission=False):
if not account and frappe.form_dict.get("account"):
account = frappe.form_dict.get("account")
if not date and frappe.form_dict.get("date"):
@@ -140,7 +141,8 @@
if account:
- if not frappe.flags.ignore_account_permission:
+ if not (frappe.flags.ignore_account_permission
+ or ignore_account_permission):
acc.check_permission("read")
if report_type == 'Profit and Loss':