Skip to content

Commit

Permalink
fix: leave application status vs max consecutive days calculation (ba…
Browse files Browse the repository at this point in the history
…ckport #1447) (#1453)

(cherry picked from commit 9d8c78d)

Co-authored-by: avc <[email protected]>
  • Loading branch information
mergify[bot] and git-avc committed Feb 21, 2024
1 parent fb47d04 commit 925af51
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions hrms/hr/doctype/leave_application/leave_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,13 @@ def _get_first_from_date(reference_date):
prev_date = add_days(reference_date, -1)
application = frappe.db.get_value(
"Leave Application",
{"employee": self.employee, "leave_type": self.leave_type, "to_date": prev_date},
{
"employee": self.employee,
"leave_type": self.leave_type,
"to_date": prev_date,
"docstatus": ["!=", 2],
"status": ["in", ["Open", "Approved"]],
},
["name", "from_date"],
as_dict=True,
)
Expand All @@ -494,7 +500,13 @@ def _get_last_to_date(reference_date):
next_date = add_days(reference_date, 1)
application = frappe.db.get_value(
"Leave Application",
{"employee": self.employee, "leave_type": self.leave_type, "from_date": next_date},
{
"employee": self.employee,
"leave_type": self.leave_type,
"from_date": next_date,
"docstatus": ["!=", 2],
"status": ["in", ["Open", "Approved"]],
},
["name", "to_date"],
as_dict=True,
)
Expand Down

0 comments on commit 925af51

Please sign in to comment.