You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a issue when creating a new Patient Appointment, in Healthcare module. Concretely, when I click the “Check Availability” button, a new dialog window opens. In this, I should select the “Medical Department”, “Healthcare Practitioner” and the “Date” of the appointment. Both “Medical Department” and “Healthcare Practitioner” are link fields. I have no problem with “Medical Department” and “Date”. However, when I what to select the Practitioner, the field doesn’t fetch the list of available Practitioners:
It should fetch the active Practitioners I’ve created:
I thought it could be because it seems to filter Practitioners based on Department. However, I removed the following piece of code (it appears two times) and nothing happened:
Long story short, the query in get_practitioner_list (erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py) should be:
query = \
"""select %s from `tabHealthcare Practitioner` where docstatus < 2
and (%s like %s or first_name like %s) and active = 1
%s
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""" \
% (
', '.join(fields),
frappe.db.escape(searchfield),
"\'%%%s%%\'" % txt,
"\'%%%s%%\'" % txt,
match_conditions,
"\'%%%s%%\'" % txt,
"\'%%%s%%\'" % txt,
start,
page_len,
)
result = frappe.db.sql(query)
return result
Explanation: the problem is with "%%%s%%" % frappe.db.escape(txt) which when the formatting is applied results in %'txt'% (where txt is the actual text in the input field) but it should be '%txt%' (that is the ' symbol enclosing the % pair, not the other way around).
Hello ERPNext Community,
I found a issue when creating a new Patient Appointment, in Healthcare module. Concretely, when I click the “Check Availability” button, a new dialog window opens. In this, I should select the “Medical Department”, “Healthcare Practitioner” and the “Date” of the appointment. Both “Medical Department” and “Healthcare Practitioner” are link fields. I have no problem with “Medical Department” and “Date”. However, when I what to select the Practitioner, the field doesn’t fetch the list of available Practitioners:
It should fetch the active Practitioners I’ve created:
I thought it could be because it seems to filter Practitioners based on Department. However, I removed the following piece of code (it appears two times) and nothing happened:
No errors in console (JS nor Python).
Testing Scenario:
Discussion in the forum: https://discuss.erpnext.com/t/patient-appointment-form-doesnt-fetch-practitioner-data/45403
The text was updated successfully, but these errors were encountered: