Added default 'All' option to filters to differentiate all and empty filter
This commit is contained in:
parent
d681c88d79
commit
aa6f00c403
@ -4,6 +4,7 @@ frappe.ui.form.on("Employee Attendance Tool", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
|
frm.doc.department = frm.doc.branch = frm.doc.company = "All";
|
||||||
frm.set_value("date", get_today());
|
frm.set_value("date", get_today());
|
||||||
erpnext.employee_attendance_tool.load_employees(frm);
|
erpnext.employee_attendance_tool.load_employees(frm);
|
||||||
},
|
},
|
||||||
|
@ -13,11 +13,18 @@ class EmployeeAttendanceTool(Document):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@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_not_marked = []
|
||||||
attendance_marked = []
|
attendance_marked = []
|
||||||
employee_list = frappe.get_list("Employee", fields=["employee", "employee_name"], filters={
|
filters = {"status": "Active"}
|
||||||
"status": "Active", "department": department, "branch": branch, "company": company}, order_by="employee_name")
|
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 = {}
|
marked_employee = {}
|
||||||
for emp in frappe.get_list("Attendance", fields=["employee", "status"],
|
for emp in frappe.get_list("Attendance", fields=["employee", "status"],
|
||||||
filters={"attendance_date": date}):
|
filters={"attendance_date": date}):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user