Hi,
I have a leave type called Festival Holidays. Is there a way to auto-approve leave if leave type is festival holidays?
Hi,
I have a leave type called Festival Holidays. Is there a way to auto-approve leave if leave type is festival holidays?
Possible using the Background Jobs
leave_applications = frappe.get_all('Leave Application',
filters={
'leave_type': 'Festival Holidays',
'docstatus': 0,
'status': 'Open'
},
fields=['name'])
for leave in leave_applications:
leave_doc = frappe.get_doc('Leave Application', leave['name'])
leave_doc.status = 'Approved'
leave_doc.docstatus = 1
leave_doc.save(ignore_permissions=True)
frappe.db.commit()
I will run daily. so set it according to the scenario!
Hi @NCP ,
If the date is in holidays list, do we still need this script or because the date you are applying leave for is already in holidays list, will it auto-approve and considers it as holiday?
you can set it according to the scenario, i just provided the sample code and reference.