mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-07 23:31:20 +00:00
Merge pull request #13985 from saurabh6790/leave_period_fix
add get leave period method
This commit is contained in:
@@ -49,3 +49,20 @@ def update_employee(employee, details, cancel=False):
|
|||||||
new_data = get_datetime(new_data)
|
new_data = get_datetime(new_data)
|
||||||
setattr(employee, item.fieldname, new_data)
|
setattr(employee, item.fieldname, new_data)
|
||||||
return employee
|
return employee
|
||||||
|
|
||||||
|
def get_leave_period(from_date, to_date, company):
|
||||||
|
leave_period = frappe.db.sql("""
|
||||||
|
select name, from_date, to_date
|
||||||
|
from `tabLeave Period`
|
||||||
|
where company=%(company)s and is_active=1
|
||||||
|
and (from_date between %(from_date)s and %(to_date)s
|
||||||
|
or to_date between %(from_date)s and %(to_date)s
|
||||||
|
or (from_date < %(from_date)s and to_date > %(to_date)s))
|
||||||
|
""", {
|
||||||
|
"from_date": from_date,
|
||||||
|
"to_date": to_date,
|
||||||
|
"company": company
|
||||||
|
}, as_dict=1)
|
||||||
|
|
||||||
|
if leave_period:
|
||||||
|
return leave_period
|
||||||
|
|||||||
Reference in New Issue
Block a user