fix(accounts): skip party dashboard without invoice permission

(cherry picked from commit ed78dd37be)
This commit is contained in:
Sudharsanan11
2026-08-04 14:10:55 +05:30
committed by Mergify
parent 02f407b82a
commit ee6955d56c

View File

@@ -854,9 +854,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"]