added company filter in employee leave balance report
diff --git a/hr/report/employee_leave_balance/employee_leave_balance.js b/hr/report/employee_leave_balance/employee_leave_balance.js
index 9f63e04..d19b48f 100644
--- a/hr/report/employee_leave_balance/employee_leave_balance.js
+++ b/hr/report/employee_leave_balance/employee_leave_balance.js
@@ -6,6 +6,13 @@
"fieldtype": "Link",
"options": "Fiscal Year",
"default": wn.defaults.get_user_default("fiscal_year")
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": wn.defaults.get_user_default("company")
}
]
}
\ No newline at end of file
diff --git a/hr/report/employee_leave_balance/employee_leave_balance.py b/hr/report/employee_leave_balance/employee_leave_balance.py
index d7ad472..6d34c8a 100644
--- a/hr/report/employee_leave_balance/employee_leave_balance.py
+++ b/hr/report/employee_leave_balance/employee_leave_balance.py
@@ -4,17 +4,19 @@
def execute(filters=None):
if not filters: filters = {}
- employees = runreport(doctype="Employee", fields=["name", "employee_name", "department"])
+
+ employee_filters = filters.get("company") and \
+ [["Employee", "company", "=", filters.get("company")]] or None
+ employees = runreport(doctype="Employee", fields=["name", "employee_name", "department"],
+ filters=employee_filters)
leave_types = webnotes.conn.sql_list("select name from `tabLeave Type`")
if filters.get("fiscal_year"):
fiscal_years = [filters["fiscal_year"]]
else:
fiscal_years = webnotes.conn.sql_list("select name from `tabFiscal Year` order by name desc")
-
- employee_in = '", "'.join([e.name for e in employees])
-
+ employee_in = '", "'.join([e.name for e in employees])
allocations = webnotes.conn.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated
from `tabLeave Allocation`