Merge pull request #4671 from Zlash65/listdown-valid-doctype
Listdown doman-activated doctype in Contacts & Address
This commit is contained in:
commit
b1ccc5d35a
1 changed files with 15 additions and 1 deletions
|
|
@ -146,4 +146,18 @@ def filter_dynamic_link_doctypes(doctype, txt, searchfield, start, page_len, fil
|
|||
order_by="dt asc", as_list=True)
|
||||
|
||||
all_doctypes = doctypes + _doctypes
|
||||
return sorted(all_doctypes, key=lambda item: item[0])
|
||||
|
||||
valid_doctypes = []
|
||||
user_roles = frappe.get_roles()
|
||||
for ctype in all_doctypes:
|
||||
if frappe.db.exists('Custom DocPerm', {"parent": ctype[0]}):
|
||||
dtype = 'Custom DocPerm'
|
||||
else:
|
||||
dtype = 'DocPerm'
|
||||
|
||||
valid_doctypes.append(frappe.db.get_all(dtype, {
|
||||
'parent': ctype[0],
|
||||
'role': ('in', user_roles)
|
||||
}, 'distinct parent', as_list=True))
|
||||
|
||||
return sorted(valid_doctypes, key=lambda item: item[0])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue