feat: add Employee Status filter in leave balance reports
diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.js b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.js
index 8bb3457..79da65c 100644
--- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.js
+++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.js
@@ -4,21 +4,21 @@
frappe.query_reports["Employee Leave Balance"] = {
"filters": [
{
- "fieldname":"from_date",
+ "fieldname": "from_date",
"label": __("From Date"),
"fieldtype": "Date",
"reqd": 1,
"default": frappe.defaults.get_default("year_start_date")
},
{
- "fieldname":"to_date",
+ "fieldname": "to_date",
"label": __("To Date"),
"fieldtype": "Date",
"reqd": 1,
"default": frappe.defaults.get_default("year_end_date")
},
{
- "fieldname":"company",
+ "fieldname": "company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
@@ -26,16 +26,23 @@
"default": frappe.defaults.get_user_default("Company")
},
{
- "fieldname":"department",
+ "fieldname": "department",
"label": __("Department"),
"fieldtype": "Link",
"options": "Department",
},
{
- "fieldname":"employee",
+ "fieldname": "employee",
"label": __("Employee"),
"fieldtype": "Link",
"options": "Employee",
+ },
+ {
+ "fieldname": "employee_status",
+ "label": __("Employee Status"),
+ "fieldtype": "Select",
+ "options": ["", "Active", "Inactive", "Suspended", "Left"],
+ "default": "Active",
}
],
diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
index ca352f1..1f7ade2 100644
--- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
+++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
@@ -168,9 +168,8 @@
def get_conditions(filters: Filters) -> Dict:
- conditions = {
- "status": "Active",
- }
+ conditions = {}
+
if filters.get("employee"):
conditions["name"] = filters.get("employee")
@@ -180,6 +179,9 @@
if filters.get("department"):
conditions["department"] = filters.get("department")
+ if filters.get("employee_status"):
+ conditions["status"] = filters.get("employee_status")
+
return conditions
diff --git a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.js b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.js
index cb05d11..3046b14 100644
--- a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.js
+++ b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.js
@@ -30,6 +30,13 @@
label: __('Department'),
fieldtype: 'Link',
options: 'Department',
+ },
+ {
+ fieldname: "employee_status",
+ label: __("Employee Status"),
+ fieldtype: "Select",
+ options: ["", "Active", "Inactive", "Suspended", "Left"],
+ default: "Active",
}
]
};
diff --git a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
index 2a16dc4..82878db 100644
--- a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
+++ b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
@@ -35,9 +35,10 @@
def get_conditions(filters):
conditions = {
- "status": "Active",
"company": filters.company,
}
+ if filters.get("employee_status"):
+ conditions.update({"status": filters.get("employee_status")})
if filters.get("department"):
conditions.update({"department": filters.get("department")})
if filters.get("employee"):