Skip to content

fix: set leave approver on bot-created leave applications - #6

Merged
NagariaHussain merged 1 commit into
developfrom
fix/leave-approver-mandatory
Aug 25, 2026
Merged

fix: set leave approver on bot-created leave applications#6
NagariaHussain merged 1 commit into
developfrom
fix/leave-approver-mandatory

Conversation

@NagariaHussain

Copy link
Copy Markdown
Contributor

Problem

/leave_application started failing with "Leave Approver is mandatory" after the Frappe HR upgrade. hrms commit 7ec198aba added a server-side validate_leave_approver() check — previously the rule was client-side only, so the bot's server-side frappe.get_doc never had to set the field.

Solution

Fill leave_approver the way the desk form does: Employee.leave_approver, falling back to the department's first approver, via HR's own get_employee_leave_approver. If nothing resolves while the setting is on, show a readable message instead of the raw upstream error.

Side effect (wanted): the approver now gets the notification and doc share that were being skipped.

Frappe HR now validates on the server that Leave Approver is set when
`leave_approver_mandatory_in_leave_application` is enabled in HR Settings
(hrms commit 7ec198aba). The bot builds the Leave Application server-side,
so it never got the value the desk form fills in, and every submission
failed with "Leave Approver is mandatory".

Resolve the approver the same way HR does (Employee.leave_approver, then
the department's first approver), and throw a readable message when none
is configured for the employee.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@NagariaHussain
NagariaHussain merged commit 818bed1 into develop Aug 25, 2026
3 checks passed
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.

1 participant