Skip to content

Commit

Permalink
fix: handle attendance condition for missing holidays
Browse files Browse the repository at this point in the history
(cherry picked from commit 631dd4a)
  • Loading branch information
ruchamahabal authored and mergify[bot] committed Feb 9, 2024
1 parent 25fb6d2 commit 0452649
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hrms/payroll/doctype/salary_slip/salary_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,16 +543,19 @@ def _get_number_of_holidays(self, holidays: list | None = None) -> float:

def _get_marked_attendance_days(self, holidays: list | None = None) -> float:
Attendance = frappe.qb.DocType("Attendance")
return (
query = (
frappe.qb.from_(Attendance)
.select(Count("*"))
.where(
(Attendance.attendance_date.between(self.actual_start_date, self.actual_end_date))
& (Attendance.employee == self.employee)
& (Attendance.docstatus == 1)
& (Attendance.attendance_date.notin(holidays))
)
).run()[0][0]
)
if holidays:
query = query.where(Attendance.attendance_date.notin(holidays))

return query.run()[0][0]

def get_payment_days(self, include_holidays_in_total_working_days):
if self.joining_date and self.joining_date > getdate(self.end_date):
Expand Down

0 comments on commit 0452649

Please sign in to comment.