fix: disabled patient shown as enabled
diff --git a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.js b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.js
index fa91884..7ba13a6 100644
--- a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.js
+++ b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.js
@@ -29,7 +29,7 @@
refresh: function(frm) {
frm.set_query("patient", function () {
return {
- filters: {"disabled": 0}
+ filters: {"status": "Disabled"}
};
});
frm.set_query("appointment", function () {
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json
index 5e39196..3bde187 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.json
@@ -70,6 +70,7 @@
},
{
"default": "0",
+ "description": "Checking this will create new Patients with a Disabled status by default and will only be enabled after invoicing the Registration Fee.",
"fieldname": "collect_registration_fee",
"fieldtype": "Check",
"label": "Collect Fee for Patient Registration"
@@ -294,7 +295,7 @@
],
"issingle": 1,
"links": [],
- "modified": "2020-01-28 18:04:48.671093",
+ "modified": "2020-01-29 10:49:00.758580",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare Settings",
diff --git a/erpnext/healthcare/doctype/patient/patient.js b/erpnext/healthcare/doctype/patient/patient.js
index 1a34fe8..9984b0a 100644
--- a/erpnext/healthcare/doctype/patient/patient.js
+++ b/erpnext/healthcare/doctype/patient/patient.js
@@ -15,7 +15,7 @@
} else {
erpnext.toggle_naming_series();
}
- if (frappe.defaults.get_default("collect_registration_fee") && frm.doc.disabled == 1) {
+ if (frappe.defaults.get_default("collect_registration_fee") && frm.doc.status == 'Disabled') {
frm.add_custom_button(__('Invoice Patient Registration'), function () {
btn_invoice_registration(frm);
});
diff --git a/erpnext/healthcare/doctype/patient/patient.json b/erpnext/healthcare/doctype/patient/patient.json
index 0136f72..7f97e17 100644
--- a/erpnext/healthcare/doctype/patient/patient.json
+++ b/erpnext/healthcare/doctype/patient/patient.json
@@ -1,4 +1,5 @@
{
+ "actions": [],
"allow_copy": 1,
"allow_import": 1,
"allow_rename": 1,
@@ -19,15 +20,14 @@
"blood_group",
"dob",
"age_html",
- "status",
"image",
"column_break_14",
+ "status",
"customer",
"report_preference",
"mobile",
"email",
"phone",
- "disabled",
"sb_relation",
"patient_relation",
"allergy_medical_and_surgical_history",
@@ -125,15 +125,15 @@
"report_hide": 1
},
{
- "default": "Active",
"fieldname": "status",
"fieldtype": "Select",
- "hidden": 1,
+ "in_filter": 1,
+ "in_list_view": 1,
"label": "Status",
"no_copy": 1,
- "options": "Active\nDormant\nOpen",
+ "options": "Active\nDisabled",
"print_hide": 1,
- "report_hide": 1
+ "read_only": 1
},
{
"fieldname": "image",
@@ -183,20 +183,9 @@
"fieldname": "phone",
"fieldtype": "Data",
"in_filter": 1,
- "in_list_view": 1,
"label": "Phone"
},
{
- "default": "0",
- "fieldname": "disabled",
- "fieldtype": "Check",
- "hidden": 1,
- "label": "Disabled",
- "no_copy": 1,
- "print_hide": 1,
- "report_hide": 1
- },
- {
"collapsible": 1,
"fieldname": "sb_relation",
"fieldtype": "Section Break",
@@ -346,8 +335,9 @@
],
"icon": "fa fa-user",
"image_field": "image",
+ "links": [],
"max_attachments": 50,
- "modified": "2019-09-25 23:30:49.905893",
+ "modified": "2020-01-29 11:22:40.698125",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Patient",
diff --git a/erpnext/healthcare/doctype/patient/patient.py b/erpnext/healthcare/doctype/patient/patient.py
index df75c01..f3fcfb5 100644
--- a/erpnext/healthcare/doctype/patient/patient.py
+++ b/erpnext/healthcare/doctype/patient/patient.py
@@ -15,8 +15,8 @@
def after_insert(self):
if(frappe.db.get_value("Healthcare Settings", None, "link_customer_to_patient") == '1' and not self.customer):
create_customer(self)
- if(frappe.db.get_value("Healthcare Settings", None, "collect_registration_fee") == '1'):
- frappe.db.set_value("Patient", self.name, "disabled", 1)
+ if frappe.db.get_single_value('Healthcare Settings', 'collect_registration_fee'):
+ frappe.db.set_value('Patient', self.name, 'status', 'Disabled')
else:
send_registration_sms(self)
self.reload()
@@ -62,7 +62,7 @@
return age_str
def invoice_patient_registration(self):
- frappe.db.set_value("Patient", self.name, "disabled", 0)
+ frappe.db.set_value("Patient", self.name, "status", "Active")
send_registration_sms(self)
if(flt(frappe.get_value("Healthcare Settings", None, "registration_fee"))>0):
company = frappe.defaults.get_user_default('company')
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js
index 858145e..1bfee7d 100644
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js
@@ -11,7 +11,7 @@
refresh: function(frm) {
frm.set_query("patient", function () {
return {
- filters: {"disabled": 0}
+ filters: {"status": "Disabled"}
};
});
frm.set_query("practitioner", function() {
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js
index 088bc81..0509259 100644
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js
+++ b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.js
@@ -62,7 +62,7 @@
frm.set_query("patient", function () {
return {
- filters: {"disabled": 0}
+ filters: {"status": "Disabled"}
};
});
frm.set_query("drug_code", "drug_prescription", function() {