diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index ca66235cff3..170a39582af 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -849,9 +849,11 @@ def validate_account_party_type(self): def get_dashboard_info(party_type, party, loyalty_program=None): - current_fiscal_year = get_fiscal_year(nowdate(), as_dict=True) - doctype = "Sales Invoice" if party_type == "Customer" else "Purchase Invoice" + if not frappe.has_permission(doctype, "read"): + return None + + current_fiscal_year = get_fiscal_year(nowdate(), as_dict=True) companies = frappe.get_list( doctype, filters={"docstatus": 1, party_type.lower(): party}, distinct=1, fields=["company"]