added new language and filters in query reports

This commit is contained in:
Rushabh Mehta
2013-02-25 13:00:16 +05:30
parent 9e02949821
commit e4eb89b02a
303 changed files with 9182 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
wn.query_reports["Employee Leave Balance"] = {
"filters": [
{
"fieldname":"fiscal_year",
"label": "Fiscal Year",
"fieldtype": "Link",
"options": "Fiscal Year",
"default": wn.defaults.get_user_default("fiscal_year")
}
]
}

View File

@@ -2,12 +2,19 @@ from __future__ import unicode_literals
import webnotes
from webnotes.widgets.reportview import execute as runreport
def execute():
def execute(filters={}):
employees = runreport(doctype="Employee", fields=["name", "employee_name", "department"])
leave_types = webnotes.conn.sql_list("select name from `tabLeave Type`")
fiscal_years = webnotes.conn.sql_list("select name from `tabFiscal Year` order by name desc")
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])
allocations = webnotes.conn.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated
from `tabLeave Allocation`
where docstatus=1 and employee in ("%s")""" % employee_in, as_dict=True)