Merge pull request #7189 from rohitwaghchaure/ignore_user_permissions_not_working

fix: user ignore permissions not working at server side
This commit is contained in:
rohitwaghchaure 2019-04-02 18:45:37 +05:30 committed by GitHub
commit f02fe1cf3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,7 +83,8 @@ def get_user_default_value(df, defaults, doctype_user_permissions, allowed_recor
if df.fieldtype == "Link" and df.options != "User":
# 1 - look in user permissions only for document_type==Setup
# We don't want to include permissions of transactions to be used for defaults.
if frappe.get_meta(df.options).document_type=="Setup" and len(allowed_records)==1:
if (frappe.get_meta(df.options).document_type=="Setup"
and len(allowed_records)==1 and not df.ignore_user_permissions):
return allowed_records[0]
# 2 - Look in user defaults