I have setup is owner permision for sales user, but now he can not able to access Customer.
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 55, in application
response = frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle
execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 36, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 879, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/search.py", line 12, in search_link
search_widget(doctype, txt, query, searchfield=searchfield, page_len=page_len, filters=filters)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/search.py", line 38, in search_widget
searchfield, start, page_len, filters)
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/search.py", line 34, in search_widget
searchfield, start, page_len, filters, as_dict=as_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 879, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/doctype/customer/customer.py", line 137, in get_customer_list
match_conditions = build_match_conditions("Customer")
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/reportview.py", line 187, in build_match_conditions
match_conditions = DatabaseQuery(doctype).build_match_conditions(as_condition=as_condition)
File "/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py", line 365, in build_match_conditions
frappe.db.escape(self.user, percent=False)))
File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 818, in escape
s = unicode(MySQLdb.escape_string(s), "utf-8").replace("`", "\\`")
TypeError: must be string or read-only buffer, not None
frappe.session.user is None? can you replicate this?
@sbkolate @rmehta @nabinhait
what is the solution? I stuck with the same error.
Thanks
@nick9822 The issue is,
In Role Permission Manager, One has checked Apply User Permissions check-box but doesn't selected any DocType to Apply Rule.
Some how it messed up.
I have reset permission, then it worked fine.
Also you are right, If I checked Is Owner, then It will give error.
File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 818, in escape
s = unicode(MySQLdb.escape_string(s), "utf-8").replace("", "\\")
TypeError: must be string or read-only buffer, not None
@sbkolate Thank you for your reply,
I followed as you said but if owner still returns an error.
So do you know any solution to this, to atleast allow sales user to see his own customers and leads? It works fine if we goto to Customer doctype it will show his customers only. But error pops-up when we try to select Customer while making an opportunity.
Thanks
@rmehta @nabinhait
Now I can replicate this issue.
1) Create User and give only Sales User Role.
2) Add Is Owner Restriction on Customer DocType for Sales user using Role Permission Manager
3) Clear-cache and go to Quotation, Try to select Customer.
@nick9822 Is Owner permission has some issue in Customer DocType. I am also looking for some solution.
@nabinhait Thanks. :+1:
Most helpful comment
Fixed via https://github.com/frappe/frappe/pull/1999