Leave application with work delegation

Hello for all…
So I want to achieve the following:

I created a new field called Leave Delegation in the Leave Application. When Employee A applies for leave and delegates the task to Employee B, I want to allow Employee B to approve this delegation.

Is it possible to add this functionality to the leave workflow?

If anyone has other ideas or methods to do that, I’m open to your advice.

add him in workflow transaction

@manal_erpnext you mean add the employee…?
here is my current workflow:

add it before the leave approver
and add new status to him

@manal_erpnext Yes, I understand, but what I mean is that it’s not just one employee. So, it’s not like a rule I can assign to a single employee. For example:
if Employee A from the Legal Department applies for leave, Employee B from the same department can take the position during Employee A’s leave. The same scenario applies to other departments.

How can I ensure that only an employee from a specific department can approve the leave for another employee in that department?

frappe.get_value("Employee", doc.employee, "department") == frappe.get_value("Employee", doc.custom_leave_delegation, "department")

@manal_erpnext
Thank you Ms. manal, so far so good… so I created a field called Leave delegation like this in the Leave application forma:


But The only way to make all employees appear here is to give each employee permission to see all other employees.
I tried to ignore user permission but also that’s not work. Do you know another way to allow each employee to see only employees from their own department…?

My name is Manal shorter than manual :slight_smile:
by client script you could did this

frappe.ui.form.on("Customer", "setup", function(frm) {
    frm.set_query("customer_group", function() {
        return {
          filters: [[
                'Customer Group', 'is_group','=', 0]]
        };
    });
});

this example for display just customer group that is child in customer doctype
understand it and modified it for yours.

Apologies, Manal!:sweat_smile:
I will try it and give you the output.

My regards.