mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-30 07:08:24 +00:00
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:
@@ -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
|
||||
},
|
||||
]
|
||||
};
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user