internal issues (#19496)

* fix: user remark mandatory in quick entry but not in form

* fix: preview salary slip btn showing in draft and unsaved states

* minor: removed unecessay comma

* fix: department analytics report showing departments of all companies
This commit is contained in:
Saqib
2019-11-06 14:41:16 +05:30
committed by Nabin Hait
parent 57f2dce682
commit 01c19d3b93
6 changed files with 32 additions and 8 deletions

View File

@@ -2,4 +2,14 @@
// For license information, please see license.txt
frappe.query_reports["Department Analytics"] = {
"filters": [
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company"),
"reqd": 1
},
]
};

View File

@@ -7,6 +7,10 @@ from frappe import _
def execute(filters=None):
if not filters: filters = {}
if not filters["company"]:
frappe.throw(_('{0} is mandatory').format(_('Company')))
columns = get_columns()
employees = get_employees(filters)
departments_result = get_department(filters)
@@ -28,6 +32,9 @@ def get_conditions(filters):
conditions = ""
if filters.get("department"): conditions += " and department = '%s'" % \
filters["department"].replace("'", "\\'")
if filters.get("company"): conditions += " and company = '%s'" % \
filters["company"].replace("'", "\\'")
return conditions
def get_employees(filters):
@@ -37,7 +44,7 @@ def get_employees(filters):
gender, company from `tabEmployee` where status = 'Active' %s""" % conditions, as_list=1)
def get_department(filters):
return frappe.db.sql("""select name from `tabDepartment`""" , as_list=1)
return frappe.db.sql("""select name from `tabDepartment` where company = %s""", (filters["company"]), as_list=1)
def get_chart_data(departments,employees):
if not departments: