Skip to content

Per-user app landing (supersedes #14) - #17

Open
hamad-clustox wants to merge 1 commit into
developfrom
feature/per-user-app-landing
Open

hamad-clustox wants to merge 1 commit into
developfrom
feature/per-user-app-landing

Conversation

@hamad-clustox

Copy link
Copy Markdown
Collaborator

Why (supersedes #14)

#14 set hrms app_home = "/hrms" to route employees to the self-service PWA. But app_home is the route of the "Frappe HR" app tile (get_route('hrms')), so it sent everyone — Administrator and HR included — to /hrms, and they could no longer open the HR Setup desk workspace. This PR fixes landing without touching app_home (it stays at the upstream /desk/hr-setup).

Changes

hrms/hooks.py — add:

role_home_page = { "Employee Self Service": "hrms" }

so self-service employees still resolve to /hrms on a bare /login, while the "Frappe HR" tile keeps opening the HR admin desk workspace for staff.

setup/permissions/set_app_landing.py — clears the global System Settings default_app (it was forcing everyone to one app) and sets landing per user:

  • staff / desk roles → erpnext (desk, /desk/home)
  • self-service employees → cleared (route via role_home_page + /hrms/login)
  • pure helpdesk agents → helpdesk

Idempotent; re-run after adding users (belongs in onboarding).

Verified on the test server

  • Administrator & HR "Frappe HR" tile → /desk/hr-setup (HR Setup) ✅
  • HR login lands on the desk; get_default_path()/desk/home
  • Employees → /hrms (entry https://<site>/hrms/login) ✅
  • Routing split: 18 desk / 3 employees / 1 agent

Action

Close #14 — merging it as-is would reintroduce the regression.

🤖 Generated with Claude Code

PR #14 pointed hrms `app_home` at /hrms so employees would land on the
self-service PWA. But `app_home` is also the route of the "Frappe HR" app tile
(get_route('hrms')), so it sent EVERYONE — including Administrator and HR — to
/hrms and they could no longer reach the HR Setup desk workspace.

Correct approach, leaving app_home at its upstream "/desk/hr-setup":
- hooks.py: add `role_home_page = {"Employee Self Service": "hrms"}` so
  self-service employees still resolve to /hrms on a bare /login.
- setup/permissions/set_app_landing.py: clear the global System Settings
  default_app and set landing per user — staff/desk roles -> erpnext (desk),
  self-service employees -> cleared (route via role_home_page + /hrms/login),
  pure helpdesk agents -> helpdesk.

Applied on the test server: HR/Administrator's "Frappe HR" tile opens
/desk/hr-setup again; employees land on /hrms. Employee entry stays
https://<site>/hrms/login.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants