Merge pull request #4104 from nabinhait/addresses_and_contacts

[fix] get permission query condition if no permitted links
This commit is contained in:
Anand Doshi 2015-10-01 14:00:38 +05:30
commit 8e7e128e81

View File

@ -54,6 +54,16 @@ def get_permission_query_conditions(doctype):
# when everything is permitted, don't add additional condition
return ""
elif not links.get("permitted_links"):
conditions = []
# when everything is not permitted
for df in links.get("not_permitted_links"):
# like ifnull(customer, '')='' and ifnull(supplier, '')=''
conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')=''".format(doctype=doctype, fieldname=df.fieldname))
return "( " + " and ".join(conditions) + " )"
else:
conditions = []