Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add HR app to apps page #2076

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading