fix: make it robust for apps for no apps screen hooks

This commit is contained in:
sokumon 2026-02-16 02:41:07 +05:30
parent 2d0c05e537
commit b90a631a93

View file

@ -116,12 +116,15 @@ class DesktopIcon(Document):
def check_app_permission(self):
for a in frappe.get_installed_apps():
if frappe.get_hooks(app_name=a)["app_title"][0] == self.label or self.app == a:
permission_method = frappe.get_hooks(app_name=a)["add_to_apps_screen"][0].get(
"has_permission", None
)
if permission_method:
return frappe.call(permission_method)
app_detail = frappe.get_hooks("add_to_apps_screen", app_name=a)
if len(app_detail) != 0:
permission_method = app_detail[0].get("has_permission", None)
if permission_method:
return frappe.call(permission_method)
else:
return True
else:
# App hooks.py doesn't have add_to_apps_screen
return True
# def is_permitted(self):