mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
fix: Check if account passed is accessible under Payment Entry
This commit is contained in:
@@ -755,6 +755,17 @@ def get_party_details(company, party_type, party, date, cost_center=None):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_account_details(account, date, cost_center=None):
|
def get_account_details(account, date, cost_center=None):
|
||||||
frappe.has_permission('Payment Entry', throw=True)
|
frappe.has_permission('Payment Entry', throw=True)
|
||||||
|
|
||||||
|
# to check if passed account is accessible under Payment Entry
|
||||||
|
# There might be user permissions which can only allow account under certain doctypes
|
||||||
|
# except Payment Entry
|
||||||
|
account_list = frappe.get_list('Account', {
|
||||||
|
'name': account
|
||||||
|
}, reference_doctype='Payment Entry', limit=1)
|
||||||
|
|
||||||
|
if not account_list:
|
||||||
|
frappe.throw(_('Account: {0} is not permitted under Payment Entry').format(account))
|
||||||
|
|
||||||
return frappe._dict({
|
return frappe._dict({
|
||||||
"account_currency": get_account_currency(account),
|
"account_currency": get_account_currency(account),
|
||||||
"account_balance": get_balance_on(account, date, cost_center=cost_center),
|
"account_balance": get_balance_on(account, date, cost_center=cost_center),
|
||||||
|
|||||||
Reference in New Issue
Block a user