fix: Use get_all instead of get_list for doc creation to avoid permission check

This commit is contained in:
Suraj Shetty 2021-10-26 12:40:37 +05:30
parent cdde111021
commit 3728e6dfdb
3 changed files with 4 additions and 4 deletions

View file

@ -37,13 +37,13 @@ def load_address_and_contact(doc, key=None):
contact_list = frappe.get_all("Contact", filters=filters, fields=["*"])
for contact in contact_list:
contact["email_ids"] = frappe.get_list("Contact Email", filters={
contact["email_ids"] = frappe.get_all("Contact Email", filters={
"parenttype": "Contact",
"parent": contact.name,
"is_primary": 0
}, fields=["email_id"])
contact["phone_nos"] = frappe.get_list("Contact Phone", filters={
contact["phone_nos"] = frappe.get_all("Contact Phone", filters={
"parenttype": "Contact",
"parent": contact.name,
"is_primary_phone": 0,

View file

@ -262,7 +262,7 @@ def get_contact_with_phone_number(number):
return contacts[0].parent if contacts else None
def get_contact_name(email_id):
contact = frappe.get_list("Contact Email", filters={"email_id": email_id}, fields=["parent"], limit=1)
contact = frappe.get_all("Contact Email", filters={"email_id": email_id}, fields=["parent"], limit=1)
return contact[0].parent if contact else None
def get_contacts_linking_to(doctype, docname, fields=None):

View file

@ -406,7 +406,7 @@ def get_contacts(email_strings, auto_create_contact=False):
return contacts
def add_contact_links_to_communication(communication, contact_name):
contact_links = frappe.get_list("Dynamic Link", filters={
contact_links = frappe.get_all("Dynamic Link", filters={
"parenttype": "Contact",
"parent": contact_name
}, fields=["link_doctype", "link_name"])