From b882d11105a4c32783190426d6129503b6e7b49c Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Tue, 13 Aug 2024 16:37:46 +0530 Subject: [PATCH] feat: add HR app to apps page (#2076) --- hrms/hooks.py | 9 +++++++++ hrms/hr/utils.py | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/hrms/hooks.py b/hrms/hooks.py index d279db84f9..0b72d7db84 100644 --- a/hrms/hooks.py +++ b/hrms/hooks.py @@ -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 # ------------------ diff --git a/hrms/hr/utils.py b/hrms/hr/utils.py index aaf1080089..d48515f4c3 100644 --- a/hrms/hr/utils.py +++ b/hrms/hr/utils.py @@ -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