fix: make it robust for apps for no apps screen hooks
This commit is contained in:
parent
2d0c05e537
commit
b90a631a93
1 changed files with 8 additions and 5 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue