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: toggle self leave approval for employees from HR settings (backport #2486) #2734

Closed
wants to merge 12 commits into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jan 30, 2025

Issue

Immediately after employees create and save leave application they see the document with "submit" as primary action that can lead to confusion as to clicking submit is part of the leave application process. So the employees ended up submitting their own leaves even if a different leave approver was already set in the application.
Role permission do not help in case one employee is leave approver for another employee.


Before

self_leave_approval_before.mov

After

self_leave_approval_pwa_after.mov
Screen.Recording.2025-01-30.at.2.46.24.PM.mov

Fix

Added a new setting in HR Settings called Prevent self-approval for leaves even if user has permissions which is disabled by default to retain current behaviour.
The submit action is removed on leave application if the settings is checked. Setting is ignored if the leave application doctype has a workflow.
Added tests for when self approval is enabled/disabled
I'll update the documentation once this is merged, no-docs for now


This is an automatic backport of pull request #2486 done by Mergify.

(cherry picked from commit c74d2bb)

# Conflicts:
#	hrms/hr/doctype/hr_settings/hr_settings.json
… based on the leave approval HR setting

(cherry picked from commit 4acf169)

# Conflicts:
#	hrms/hr/doctype/leave_application/leave_application.js
#	hrms/hr/doctype/leave_application/leave_application.py
(cherry picked from commit 525fcdd)
refactor: used onload to check hr settings
refactor: hr setting name changed for readability

(cherry picked from commit 52b5e1f)

# Conflicts:
#	hrms/hr/doctype/hr_settings/hr_settings.json
#	hrms/hr/doctype/leave_application/leave_application.js
(cherry picked from commit e49c5a7)

# Conflicts:
#	hrms/hr/doctype/hr_settings/hr_settings.json
(cherry picked from commit bb15010)

# Conflicts:
#	hrms/hr/doctype/leave_application/leave_application.js
@mergify mergify bot requested a review from ruchamahabal as a code owner January 30, 2025 09:37
@mergify mergify bot added the conflicts label Jan 30, 2025
Copy link
Contributor Author

mergify bot commented Jan 30, 2025

Cherry-pick of c74d2bb has failed:

On branch mergify/bp/version-14-hotfix/pr-2486
Your branch is up to date with 'origin/version-14-hotfix'.

You are currently cherry-picking commit c74d2bb2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   hrms/hr/doctype/hr_settings/hr_settings.json

no changes added to commit (use "git add" and/or "git commit -a")

Cherry-pick of 4acf169 has failed:

On branch mergify/bp/version-14-hotfix/pr-2486
Your branch is ahead of 'origin/version-14-hotfix' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 4acf169c.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   hrms/hr/doctype/leave_application/leave_application.js
	both modified:   hrms/hr/doctype/leave_application/leave_application.py

no changes added to commit (use "git add" and/or "git commit -a")

Cherry-pick of 52b5e1f has failed:

On branch mergify/bp/version-14-hotfix/pr-2486
Your branch is ahead of 'origin/version-14-hotfix' by 8 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 52b5e1f9.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   hrms/hr/doctype/leave_application/leave_application.py
	modified:   hrms/hr/doctype/leave_application/test_leave_application.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   hrms/hr/doctype/hr_settings/hr_settings.json
	both modified:   hrms/hr/doctype/leave_application/leave_application.js

Cherry-pick of e49c5a7 has failed:

On branch mergify/bp/version-14-hotfix/pr-2486
Your branch is ahead of 'origin/version-14-hotfix' by 9 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit e49c5a72.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   hrms/hr/doctype/hr_settings/hr_settings.json

no changes added to commit (use "git add" and/or "git commit -a")

Cherry-pick of bb15010 has failed:

On branch mergify/bp/version-14-hotfix/pr-2486
Your branch is ahead of 'origin/version-14-hotfix' by 11 commits.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit bb15010d.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   hrms/hr/doctype/leave_application/leave_application.js

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@asmitahase
Copy link
Collaborator

Most new settings in HR aren't available in v14, skipping this one too.

@asmitahase asmitahase closed this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant