Skip to content

Commit

Permalink
feat: add HR app to apps page (#2076)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchamahabal authored Aug 13, 2024
1 parent 03d5b85 commit b882d11
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hrms/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
required_apps = ["frappe/erpnext"]
source_link = "http://github.com/frappe/hrms"

add_to_apps_screen = [
{
"name": "hrms",
"logo": "/assets/hrms/images/frappe-hr-logo.svg",
"title": "Frappe HR",
"route": "/app/hr",
"has_permission": "hrms.hr.utils.check_app_permission",
}
]

# Includes in <head>
# ------------------
Expand Down
11 changes: 11 additions & 0 deletions hrms/hr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,3 +845,14 @@ def notify_bulk_action_status(doctype: str, failure: list, success: list) -> Non
title=title,
is_minimizable=True,
)


def check_app_permission():
"""Check if user has permission to access the app (for showing the app on app screen)"""
if frappe.session.user == "Administrator":
return True

if frappe.has_permission("Employee", ptype="read"):
return True

return False

0 comments on commit b882d11

Please sign in to comment.