bugfix in User
This commit is contained in:
parent
b5aa26b7bc
commit
8c77327060
5 changed files with 13 additions and 11 deletions
|
|
@ -557,7 +557,7 @@ def get_list(doctype, filters=None, fields=None, docstatus=None,
|
|||
import frappe.model.db_query
|
||||
return frappe.model.db_query.DatabaseQuery(doctype).execute(filters=filters, fields=fields, docstatus=docstatus,
|
||||
group_by=group_by, order_by=order_by, limit_start=limit_start, limit_page_length=limit_page_length,
|
||||
as_list=as_list, debug=debug)
|
||||
as_list=as_list, debug=debug, ignore_permissions=ignore_permissions)
|
||||
|
||||
run_query = get_list
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ def application(request):
|
|||
response = frappe.utils.response.report_error(e.http_status_code)
|
||||
|
||||
if e.__class__ == frappe.AuthenticationError:
|
||||
frappe.local.login_manager.clear_cookies()
|
||||
if hasattr(frappe.local, "login_manager"):
|
||||
frappe.local.login_manager.clear_cookies()
|
||||
|
||||
else:
|
||||
if frappe.local.request.method in ("POST", "PUT") and frappe.db:
|
||||
|
|
|
|||
|
|
@ -202,12 +202,10 @@ def validate_fields(fields):
|
|||
frappe.msgprint("""#%(idx)s %(label)s: Cannot be hidden and mandatory (reqd) without default""" % d.fields,
|
||||
raise_exception=True)
|
||||
|
||||
def check_max_items_in_list(fields):
|
||||
count = 0
|
||||
for d in fields:
|
||||
if d.in_list_view: count+=1
|
||||
if count > 5:
|
||||
frappe.msgprint("""Max 5 Fields can be set as 'In List View', please unselect a field before selecting a new one.""")
|
||||
def check_min_items_in_list(fields):
|
||||
if len(filter(lambda d: d.in_list_view, fields))==0:
|
||||
for d in fields[:5]:
|
||||
d.in_list_view = 1
|
||||
|
||||
def check_width(d):
|
||||
if d.fieldtype == "Currency" and cint(d.width) < 100:
|
||||
|
|
@ -228,6 +226,8 @@ def validate_fields(fields):
|
|||
check_hidden_and_mandatory(d)
|
||||
check_in_list_view(d)
|
||||
|
||||
check_min_items_in_list(fields)
|
||||
|
||||
def validate_permissions_for_doctype(doctype, for_remove=False):
|
||||
from frappe.model.doctype import get
|
||||
validate_permissions(get(doctype, cached=False).get({"parent":doctype,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ class DocType:
|
|||
self.validate_email_type(self.doc.email)
|
||||
self.add_system_manager_role()
|
||||
self.check_enable_disable()
|
||||
self.doc.new_password = ""
|
||||
self.update_gravatar()
|
||||
|
||||
def check_enable_disable(self):
|
||||
|
|
@ -88,6 +87,8 @@ class DocType:
|
|||
|
||||
except frappe.OutgoingEmailError:
|
||||
pass # email server not set, don't send email
|
||||
|
||||
self.doc.set("new_password", "")
|
||||
|
||||
def update_gravatar(self):
|
||||
import md5
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class DatabaseQuery(object):
|
|||
args.group_by = self.group_by and (" group by " + self.group_by) or ""
|
||||
|
||||
self.check_sort_by_table(args.order_by)
|
||||
|
||||
|
||||
return args
|
||||
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ class DatabaseQuery(object):
|
|||
doctype = t[4:-1]
|
||||
if self.meta.get(doctype):
|
||||
continue
|
||||
if not frappe.has_permission(doctype):
|
||||
if (not self.ignore_permissions) and (not frappe.has_permission(doctype)):
|
||||
raise frappe.PermissionError, doctype
|
||||
self.meta[doctype] = frappe.model.doctype.get(doctype)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue