Contradicting code in HR

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
from 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))
if leave:
lwp = cint(leave[0][1]) and (lwp + 0.5) or (lwp + 1)
return lwp

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?

Why should holiday be considered as LWP?

Isn’t that evil?

But then, that's what the setting in leave type setup does...we have option to include the holidays as leaves...shouldn't that setting reflect in payroll calculation as well?

Evil or not, this is what most companies are following...I have been against this policy since the day I started my career in late 90's...but not much I can do/

@rmehta I replied from email, and I’m afraid it may not have brought it up to your notice. Hence this post. Can you please check my comment above?

I see something related to HR and couldn’t stop myself involving.

In most of the countries labor law clearly state employee enjoys full benefits in holidays. Manually, you can enter lwp holidays for your employees for specific dates.

Maybe another setting for LWP. I think LWP should be an exception to the setting

btw, now you have a reason to fight the evil rule, ‘the ERP won’t do it’

CC @vjFaLk