From 7a79e4cbd1e8b39af62c5c0b4e49919591dd4e2d Mon Sep 17 00:00:00 2001 From: Himanshu Warekar Date: Wed, 21 Aug 2019 16:09:54 +0530 Subject: [PATCH] fix: return parent from contact phone --- frappe/contacts/doctype/contact/contact.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frappe/contacts/doctype/contact/contact.py b/frappe/contacts/doctype/contact/contact.py index 400fefe64d..ab8b114192 100644 --- a/frappe/contacts/doctype/contact/contact.py +++ b/frappe/contacts/doctype/contact/contact.py @@ -204,11 +204,11 @@ def contact_query(doctype, txt, searchfield, start, page_len, filters): def get_contact_with_phone_number(number): if not number: return - contacts = frappe.get_all('Contact', filters=[ - ['Contact Phone', 'phone', 'like' '%{}'.format(number)] - ], limit=1) + contacts = frappe.get_all('Contact Phone', filters=[ + ['phone', 'like', '{0}'.format(number)] + ], fields=["parent"], limit=1) - return contacts[0].name if contacts else None + 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)