added company filter in employee leave balance report
This commit is contained in:
parent
46d437e2ef
commit
5c6fc62b9e
@ -6,6 +6,13 @@ wn.query_reports["Employee Leave Balance"] = {
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Fiscal Year",
|
"options": "Fiscal Year",
|
||||||
"default": wn.defaults.get_user_default("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")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -4,7 +4,11 @@ from webnotes.widgets.reportview import execute as runreport
|
|||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
if not filters: filters = {}
|
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`")
|
leave_types = webnotes.conn.sql_list("select name from `tabLeave Type`")
|
||||||
|
|
||||||
if filters.get("fiscal_year"):
|
if filters.get("fiscal_year"):
|
||||||
@ -14,8 +18,6 @@ def execute(filters=None):
|
|||||||
|
|
||||||
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
|
allocations = webnotes.conn.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated
|
||||||
from `tabLeave Allocation`
|
from `tabLeave Allocation`
|
||||||
where docstatus=1 and employee in ("%s")""" % employee_in, as_dict=True)
|
where docstatus=1 and employee in ("%s")""" % employee_in, as_dict=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user