Possible Bug in HR Employee Module

Since the latest update ie v 12.8
Whenever I open the Employee Module, an error message pops up which says
TypeError: must be str, not list

Looks like a bug

It pops up not only in HR Module but several other modules as well. Is no one else facing it ?

same with me, currently facing this issue when open item list

Share the versions and browse console output error

v12.8.0

Log

jquery.min.js:4 GET https://companyname/api/method/frappe.client.get_count?filters=%5B%5B%22Employee%22%2C%22status%22%2C%22%3D%22%2C%22Active%22%5D%5D&doctype=Employee&_=1594452119932 500 (INTERNAL SERVER ERROR)

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 64, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 59, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 24, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 63, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1054, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/client.py", line 39, in get_count
    return frappe.db.count(doctype, get_safe_filters(filters), debug, cache)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py", line 808, in count
    conditions, filters = self.build_conditions(filters)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py", line 365, in build_conditions
    _build_condition(f)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py", line 327, in _build_condition
    _rhs = " %(" + key + ")s"
TypeError: must be str, not list


request.js:241 TypeError: frappe.utils.setup_search is not a function
    at Object.callback (list_sidebar.js:261)
    at Object.success [as success_callback] (request.js:76)
    at 200 (request.js:114)
    at Object.<anonymous> (request.js:237)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at z (jquery.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery.min.js:4)

I have tried to put out the console log. Its my first time, please let me know if it worked our correctly

I believe this is the console log you are looking for

bench/apps/frappe/frappe/database/database.py", line 327, in _build_condition
    _rhs = " %(" + key + ")s"
TypeError: must be str, not list

@mainul bhai, please help him.

The Issue due to frontend send request filters as query filters [[]] for frappe.db.count this format. it’s it’s format of query. so you can override this whitelisted method by code.

For override use this in hooks.py file.

override_whitelisted_methods = {
	"frappe.client.get_count": "[yourapp].[module/file].[methodname]"
}

Code in you module/file.

@frappe.whitelist()
def get_count(doctype, filters=None, debug=False, cache=False):
	return frappe.get_all(doctype, filters=get_safe_filters(filters), fields='count(*)', debug=debug, as_list=True)[0][0]
2 Likes

Thanks but is this only specific to me. Shouldn’t this should be fixed in the core.

Hopefully next version will be fix it.

The new version fixes it. Being lazy paid off :relaxed: :laughing:
Thank you for your effort in answering it.

itttts BACK! lol

Here is my trace back
Traceback (most recent call last):
File “/home/recharger/frappe-bench/apps/frappe/frappe/app.py”, line 64, in application
response = frappe.api.handle()
File “/home/recharger/frappe-bench/apps/frappe/frappe/api.py”, line 59, in handle
return frappe.handler.handle()
File “/home/recharger/frappe-bench/apps/frappe/frappe/handler.py”, line 24, in handle
data = execute_cmd(cmd)
File “/home/recharger/frappe-bench/apps/frappe/frappe/handler.py”, line 63, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/recharger/frappe-bench/apps/frappe/frappe/init.py”, line 1055, in call
return fn(*args, **newargs)
File “/home/recharger/frappe-bench/apps/frappe/frappe/client.py”, line 39, in get_count
return frappe.db.count(doctype, get_safe_filters(filters), debug, cache)
File “/home/recharger/frappe-bench/apps/frappe/frappe/database/database.py”, line 808, in count
conditions, filters = self.build_conditions(filters)
File “/home/recharger/frappe-bench/apps/frappe/frappe/database/database.py”, line 365, in build_conditions
_build_condition(f)
File “/home/recharger/frappe-bench/apps/frappe/frappe/database/database.py”, line 327, in _build_condition
_rhs = " %(" + key + “)s”
TypeError: must be str, not list

This is showing up in the RFQ App after the update to

Installed Apps

ERPNext: v12.11.0 (version-12)

Frappe Framework: v12.9.0 (version-12)

Recharge: v0.0.1 (master)

Any help would be appreciated

Actually this error is coming up on all my list views. Whenever a filter is defined or anything is in the filter options, the same error shows up.

Final line of the traceback…
File “/home/recharger/frappe-bench/apps/frappe/frappe/database/database.py”, line 327, in _build_condition
_rhs = " %(" + key + “)s”