Healthcare hotfix (#11586)
* On Cancel Consultation - Open Appointment - Delete Medical Record
* Add Filter on Account Selection - is_group: 0
* Patient Medical Record - List view Fixes
* Update consultation.py
diff --git a/erpnext/healthcare/doctype/consultation/consultation.py b/erpnext/healthcare/doctype/consultation/consultation.py
index 11b5ed2..69d7ecb 100755
--- a/erpnext/healthcare/doctype/consultation/consultation.py
+++ b/erpnext/healthcare/doctype/consultation/consultation.py
@@ -8,12 +8,12 @@
from frappe.model.document import Document
from frappe.utils import getdate
import json
-from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account,get_income_account
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account
class Consultation(Document):
def on_update(self):
if(self.appointment):
- frappe.db.set_value("Patient Appointment",self.appointment,"status","Closed")
+ frappe.db.set_value("Patient Appointment", self.appointment, "status", "Closed")
update_consultation_to_medical_record(self)
def after_insert(self):
@@ -23,6 +23,11 @@
if not self.diagnosis or not self.symptoms:
frappe.throw("Diagnosis and Complaints cannot be left blank")
+ def on_cancel(self):
+ if(self.appointment):
+ frappe.db.set_value("Patient Appointment", self.appointment, "status", "Open")
+ delete_medical_record(self)
+
def set_sales_invoice_fields(company, patient):
sales_invoice = frappe.new_doc("Sales Invoice")
sales_invoice.customer = frappe.get_value("Patient", patient, "customer")
@@ -87,8 +92,8 @@
item_line.qty = 1
item_line.uom = "Nos"
item_line.conversion_factor = 1
- item_line.income_account = get_income_account(physician,company)
- op_consulting_charge = frappe.get_value("Physician",physician,"op_consulting_charge")
+ item_line.income_account = get_income_account(physician, company)
+ op_consulting_charge = frappe.get_value("Physician", physician, "op_consulting_charge")
if op_consulting_charge:
item_line.rate = op_consulting_charge
item_line.amount = op_consulting_charge
@@ -107,10 +112,13 @@
medical_record.save(ignore_permissions=True)
def update_consultation_to_medical_record(consultation):
- medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s",(consultation.name))
+ medical_record_id = frappe.db.sql("select name from `tabPatient Medical Record` where reference_name=%s", (consultation.name))
if(medical_record_id[0][0]):
subject = set_subject_field(consultation)
- frappe.db.set_value("Patient Medical Record",medical_record_id[0][0],"subject",subject)
+ frappe.db.set_value("Patient Medical Record", medical_record_id[0][0], "subject", subject)
+
+def delete_medical_record(consultation):
+ frappe.db.sql("""delete from `tabPatient Medical Record` where reference_name = %s""", (consultation.name))
def set_subject_field(consultation):
subject = "No Diagnosis "
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
index 75b0584..8e98fee 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.js
@@ -9,6 +9,7 @@
filters: {
'account_type': 'Receivable',
'company': d.company,
+ 'is_group': 0
}
};
});
@@ -18,6 +19,7 @@
filters: {
'root_type': 'Income',
'company': d.company,
+ 'is_group': 0
}
};
});
diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
index 9cbcf7b..6edc0cc 100644
--- a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
+++ b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.json
@@ -56,7 +56,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
- "in_list_view": 0,
+ "in_list_view": 1,
"in_standard_filter": 0,
"label": "Patient",
"length": 0,
@@ -174,7 +174,7 @@
"ignore_xss_filter": 1,
"in_filter": 0,
"in_global_search": 0,
- "in_list_view": 1,
+ "in_list_view": 0,
"in_standard_filter": 0,
"label": "Subject",
"length": 0,
@@ -236,7 +236,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
- "in_list_view": 0,
+ "in_list_view": 1,
"in_standard_filter": 0,
"label": "Datetime",
"length": 0,
@@ -266,7 +266,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
- "in_list_view": 0,
+ "in_list_view": 1,
"in_standard_filter": 0,
"label": "Reference DocType",
"length": 0,
@@ -297,7 +297,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
- "in_list_view": 0,
+ "in_list_view": 1,
"in_standard_filter": 0,
"label": "Reference Name",
"length": 0,
@@ -389,7 +389,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2017-10-04 16:09:55.597866",
+ "modified": "2017-11-15 12:48:59.945615",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Patient Medical Record",
@@ -425,6 +425,7 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
+ "title_field": "patient",
"track_changes": 1,
"track_seen": 1
}
\ No newline at end of file
diff --git a/erpnext/healthcare/doctype/physician/physician.js b/erpnext/healthcare/doctype/physician/physician.js
index 37389fe..c607f23 100755
--- a/erpnext/healthcare/doctype/physician/physician.js
+++ b/erpnext/healthcare/doctype/physician/physician.js
@@ -9,6 +9,7 @@
filters: {
'root_type': 'Income',
'company': d.company,
+ 'is_group': 0
}
};
});