Skip to content

Commit

Permalink
fix: employee & grade filters not considered while allocating leaves …
Browse files Browse the repository at this point in the history
…via Leave Control Panel (#456)

Co-authored-by: Rucha Mahabal <[email protected]>
  • Loading branch information
ovresko and ruchamahabal authored May 2, 2023
1 parent ef70e4d commit 562b3cc
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions hrms/hr/doctype/leave_control_panel/leave_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,23 @@
class LeaveControlPanel(Document):
def get_employees(self):
conditions, values = [], []
for field in ["company", "employment_type", "branch", "designation", "department"]:
for field in [
"company",
"employment_type",
"branch",
"designation",
"department",
"employee",
"employee_grade",
]:
if self.get(field):
conditions.append("{0}=%s".format(field))
if field == "employee":
conditions.append("name=%s")
elif field == "employee_grade":
conditions.append("grade=%s")
else:
conditions.append("{0}=%s".format(field))

values.append(self.get(field))

condition_str = " and " + " and ".join(conditions) if len(conditions) else ""
Expand Down

0 comments on commit 562b3cc

Please sign in to comment.