refactor: show Patient History feed as per configured date instead of creation
diff --git a/erpnext/healthcare/page/patient_history/patient_history.js b/erpnext/healthcare/page/patient_history/patient_history.js
index d509ea2..9c44d63 100644
--- a/erpnext/healthcare/page/patient_history/patient_history.js
+++ b/erpnext/healthcare/page/patient_history/patient_history.js
@@ -254,7 +254,7 @@
};
let add_date_separator = function(data) {
- let date = frappe.datetime.str_to_obj(data.creation);
+ let date = frappe.datetime.str_to_obj(data.communication_date);
let pdate = '';
let diff = frappe.datetime.get_day_diff(frappe.datetime.get_today(), frappe.datetime.obj_to_str(date));
diff --git a/erpnext/healthcare/page/patient_history/patient_history.py b/erpnext/healthcare/page/patient_history/patient_history.py
index de8a577..4cdfd64 100644
--- a/erpnext/healthcare/page/patient_history/patient_history.py
+++ b/erpnext/healthcare/page/patient_history/patient_history.py
@@ -14,10 +14,10 @@
filters = get_filters(name, document_types, date_range)
result = frappe.db.get_all('Patient Medical Record',
- fields=['name', 'owner', 'creation',
+ fields=['name', 'owner', 'communication_date',
'reference_doctype', 'reference_name', 'subject'],
filters=filters,
- order_by='creation DESC',
+ order_by='communication_date DESC',
limit=cint(page_length),
start=cint(start)
)
@@ -36,7 +36,7 @@
try:
date_range = json.loads(date_range)
if date_range:
- filters['creation'] = ['between', [date_range[0], date_range[1]]]
+ filters['communication_date'] = ['between', [date_range[0], date_range[1]]]
except json.decoder.JSONDecodeError:
pass
@@ -47,13 +47,13 @@
def get_feed_for_dt(doctype, docname):
"""get feed"""
result = frappe.db.get_all('Patient Medical Record',
- fields=['name', 'owner', 'creation',
+ fields=['name', 'owner', 'communication_date',
'reference_doctype', 'reference_name', 'subject'],
filters={
'reference_doctype': doctype,
'reference_name': docname
},
- order_by='creation DESC'
+ order_by='communication_date DESC'
)
return result