Added default 'All' option to filters to differentiate all and empty filter

This commit is contained in:
Kanchan Chauhan 2017-04-06 12:38:13 +05:30 committed by Nabin Hait
parent d681c88d79
commit aa6f00c403
2 changed files with 11 additions and 3 deletions

View File

@ -4,6 +4,7 @@ frappe.ui.form.on("Employee Attendance Tool", {
},
onload: function(frm) {
frm.doc.department = frm.doc.branch = frm.doc.company = "All";
frm.set_value("date", get_today());
erpnext.employee_attendance_tool.load_employees(frm);
},

View File

@ -13,11 +13,18 @@ class EmployeeAttendanceTool(Document):
@frappe.whitelist()
def get_employees(date, department=None, branch=None, company=None):
def get_employees(date, department = None, branch = None, company = None):
attendance_not_marked = []
attendance_marked = []
employee_list = frappe.get_list("Employee", fields=["employee", "employee_name"], filters={
"status": "Active", "department": department, "branch": branch, "company": company}, order_by="employee_name")
filters = {"status": "Active"}
if department != "All":
filters["department"] = department
if branch != "All":
filters["branch"] = branch
if company != "All":
filters["company"] = company
employee_list = frappe.get_list("Employee", fields=["employee", "employee_name"], filters=filters, order_by="employee_name")
marked_employee = {}
for emp in frappe.get_list("Attendance", fields=["employee", "status"],
filters={"attendance_date": date}):