How to set department wise leave approvers in Frappe HR

I want to set Department wise Leave Approvers and want to send mail to that approvers while create a leave application.
I have tried to much for this but still i didn’t get any solution for this.

Hi @DivyB ,

Set the Leave Approvers in child table of Department master. Refere SS:

Set Leave Approver in Employee Master

And There is an option Send Leave Notification in HR Settings to enable the Email Notification and set the email template for the same. Refer SS:

Thanks,
Daizy Modi

Hy @DaizyModi ,
I tried this too ,
In Department i set 3 leave approvers and in employee i Add One of them approver,
But It is Sending email to One Leave Approver only that is set in employee.

From Frappe HR Documentation, https://docs.frappe.io/hr/leave-application

“If Leave Approvers are set at both Employee-level and Department-level, the Employee-level Leave Approver will be considered as the default Leave Approver in this case.”
" * Department Level: Leave Approvers for each department can be configured in the Department master. Multiple Leave Approvers can be set in a Department. The first Leave Approver in the list will be considered as the default Leave Approver."

But i want to sent Leave Application email to all depart leave approver and also when i set department leave approvers and not setting leave approver in employee it shows error message while creating Leave Application how can i manage both ??

Hi @DivyB ,

If you want to send email to all leave approvers, write custom code to send emails on Creation of Leave Application.

frappe.sendmail(
    recipients= [recipients],
    subject=subject,
    message=message,
    now=True
)

where recipients will be the list of leave approvers from the Department master.

Hi @DaizyModi ,
i add this but this time it is sending emails to leave approvers from department but it is sending mail 2 times.
i set a new notification for leave application( ERPNext Settings → Notification)
i want to set custom leave application formate and i have create a leave applicatin formate in Email Templates and set it defauls in HR Settings.


leave Approval is Custom Template for leave applications.

this is my Notification for leave applications