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 (backport #456) (#490)

Co-authored-by: Rucha Mahabal <[email protected]>
Co-authored-by: ovresko <[email protected]>
  • Loading branch information
3 people authored May 2, 2023
1 parent bf2e631 commit c39eaad
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 c39eaad

Please sign in to comment.