From 5aaf15d145576b57a4e670166d21c5e49db51e4c Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Thu, 5 Sep 2019 14:42:28 +0530 Subject: [PATCH] fix: healthcare practitioner not showing in the dropdown (#18929) --- .../healthcare_practitioner.py | 33 +++---------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py index ed9eae3529..ad32e94631 100644 --- a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py +++ b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py @@ -69,33 +69,10 @@ def validate_service_item(item, msg): def get_practitioner_list(doctype, txt, searchfield, start, page_len, filters=None): fields = ["name", "first_name", "mobile_phone"] - match_conditions = build_match_conditions("Healthcare Practitioner") - match_conditions = "and {}".format(match_conditions) if match_conditions else "" - if filters: - filter_conditions = get_filters_cond(doctype, filters, []) - match_conditions += "{}".format(filter_conditions) + filters = { + 'name': ("like", "%%%s%%" % txt) + } - return frappe.db.sql("""select %s from `tabHealthcare Practitioner` where docstatus < 2 - and (%s like %s or first_name like %s) - and active = 1 - {match_conditions} - order by - case when name like %s then 0 else 1 end, - case when first_name like %s then 0 else 1 end, - name, first_name limit %s, %s""".format( - match_conditions=match_conditions) % - ( - ", ".join(fields), - frappe.db.escape(searchfield), - "%s", "%s", "%s", "%s", "%s", "%s" - ), - ( - "%%%s%%" % frappe.db.escape(txt), - "%%%s%%" % frappe.db.escape(txt), - "%%%s%%" % frappe.db.escape(txt), - "%%%s%%" % frappe.db.escape(txt), - start, - page_len - ) - ) + return frappe.get_all("Healthcare Practitioner", fields = fields, + filters = filters, start=start, page_length=page_len, order_by="name, first_name", as_list=1)