fix: return default user permission as the leading element
This commit is contained in:
parent
e32efa295e
commit
f784d5d026
1 changed files with 5 additions and 1 deletions
|
|
@ -143,7 +143,11 @@ def get_applicable_for_doctype_list(doctype, txt, searchfield, start, page_len,
|
|||
return return_list
|
||||
|
||||
def get_permitted_documents(doctype):
|
||||
return [d.get('doc') for d in get_user_permissions().get(doctype, []) \
|
||||
''' Returns permitted documents from the given doctype for the session user '''
|
||||
# sort permissions in a way to make the first permission in the list to be default
|
||||
user_perm_list = sorted(get_user_permissions().get(doctype, []), key=lambda x: x.get('is_default'), reverse=True)
|
||||
|
||||
return [d.get('doc') for d in user_perm_list \
|
||||
if d.get('doc')]
|
||||
|
||||
@frappe.whitelist()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue