From e0e452bdcc1c8dd03e4261e24a48abc8bdf095ad Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 20 Jun 2022 11:11:10 +0530 Subject: [PATCH] fix: incorrect filtering on address doctype (#17241) [skip ci] --- frappe/contacts/address_and_contact.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frappe/contacts/address_and_contact.py b/frappe/contacts/address_and_contact.py index 1461690378..8d078196e0 100644 --- a/frappe/contacts/address_and_contact.py +++ b/frappe/contacts/address_and_contact.py @@ -177,7 +177,6 @@ def filter_dynamic_link_doctypes( txt = txt or "" filters = filters or {} - TXT_PATTERN = re.compile(f"{txt}.*") _doctypes_from_df = frappe.get_all( "DocField", @@ -186,13 +185,13 @@ def filter_dynamic_link_doctypes( distinct=True, order_by=None, ) - doctypes_from_df = {d for d in _doctypes_from_df if TXT_PATTERN.search(_(d), re.IGNORECASE)} + doctypes_from_df = {d for d in _doctypes_from_df if txt.lower() in d.lower()} filters.update({"dt": ("not in", doctypes_from_df)}) _doctypes_from_cdf = frappe.get_all( "Custom Field", filters=filters, pluck="dt", distinct=True, order_by=None ) - doctypes_from_cdf = {d for d in _doctypes_from_cdf if TXT_PATTERN.search(_(d), re.IGNORECASE)} + doctypes_from_cdf = {d for d in _doctypes_from_cdf if txt.lower() in d.lower()} all_doctypes = doctypes_from_df.union(doctypes_from_cdf) allowed_doctypes = set(get_doctypes_with_read())