fix in get defaults as list
This commit is contained in:
parent
3d011c8816
commit
862f181ae2
2 changed files with 3 additions and 3 deletions
|
|
@ -275,7 +275,7 @@ def has_permission(doctype, ptype="read", doc=None):
|
|||
and ifnull(p.permlevel,0) = 0
|
||||
and (p.role="All" or p.role in (select `role` from tabUserRole where `parent`=%s))
|
||||
""" % ("%s", ptype, "%s"), (doctype, session.user), as_dict=1)
|
||||
|
||||
|
||||
if doc:
|
||||
match_failed = {}
|
||||
for p in perms:
|
||||
|
|
@ -284,7 +284,7 @@ def has_permission(doctype, ptype="read", doc=None):
|
|||
keys = p.match.split(":")
|
||||
else:
|
||||
keys = [p.match, p.match]
|
||||
|
||||
|
||||
if doc.fields.get(keys[0],"[No Value]") \
|
||||
in conn.get_defaults_as_list(keys[1], session.user):
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ class Database:
|
|||
def get_defaults_as_list(self, key, parent="Control Panel"):
|
||||
ret = [r[0] for r in self.sql("""select defvalue from \
|
||||
tabDefaultValue where defkey=%s and parent=%s""", (key, parent))]
|
||||
if key=="owner" and webnotes.session:
|
||||
if key in ["owner", "user"] and webnotes.session:
|
||||
ret.append(webnotes.session.user)
|
||||
return ret
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue