feat: Added default Leave Approver in Employee (#18953)
This commit is contained in:
parent
8e67a3a8a8
commit
3b366c30a8
@ -7,6 +7,7 @@
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"basic_information",
|
||||
"employee",
|
||||
@ -54,6 +55,7 @@
|
||||
"column_break_44",
|
||||
"holiday_list",
|
||||
"default_shift",
|
||||
"leave_approver",
|
||||
"salary_information",
|
||||
"salary_mode",
|
||||
"bank_name",
|
||||
@ -767,12 +769,18 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Default Shift",
|
||||
"options": "Shift Type"
|
||||
},
|
||||
{
|
||||
"fieldname": "leave_approver",
|
||||
"fieldtype": "Link",
|
||||
"label": "Leave Approver",
|
||||
"options": "User"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-user",
|
||||
"idx": 24,
|
||||
"image_field": "image",
|
||||
"modified": "2019-06-01 16:05:55.132180",
|
||||
"modified": "2019-09-06 15:54:36.735147",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Employee",
|
||||
|
@ -745,10 +745,12 @@ def get_approved_leaves_for_period(employee, leave_type, from_date, to_date):
|
||||
return leave_days
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_leave_approver(employee, department=None):
|
||||
if not department:
|
||||
department = frappe.db.get_value('Employee', employee, 'department')
|
||||
def get_leave_approver(employee):
|
||||
leave_approver, department = frappe.db.get_value("Employee",
|
||||
employee, ["leave_approver", "department"])
|
||||
|
||||
if department:
|
||||
return frappe.db.get_value('Department Approver', {'parent': department,
|
||||
'parentfield': 'leave_approvers', 'idx': 1}, 'approver')
|
||||
if not leave_approver and department:
|
||||
leave_approver = frappe.db.get_value('Department Approver', {'parent': department,
|
||||
'parentfield': 'leave_approvers', 'idx': 1}, 'approver')
|
||||
|
||||
return leave_approver
|
Loading…
Reference in New Issue
Block a user