Scenario: While defining leaves, all my leave types have the checkbox “Incluide holidays within leaves as leaves”
It means that a holiday falling in between leaves will be treated as leave as well. This is applicable for lwp also.
But the lwp calculation function in salary_slip.py excludes the holidays. This is in contrary to the above setup.
def calculate_lwp(self, holidays, m):
lwp = 0
for d in range(m[‘month_days’]):
dt = add_days(cstr(m[‘month_start_date’]), d)
if dt not in holidays:
leave = frappe.db.sql(“”"
select t1.name, t1.half_day
tabLeave Application t1,
tabLeave Type t2
where t2.name = t1.leave_type
and t2.is_lwp = 1
and t1.docstatus = 1
and t1.employee = %s
and %s between from_date and to_date
“”", (self.employee, dt))
lwp = cint(leave) and (lwp + 0.5) or (lwp + 1)
The bolded if condition in the above code negates the setting in leave type. instead of this if condition, the system should check the setting for leave type, and decide to include the day as lwp or not accordingly.
Is my understanding correct?