fix: disabled patient shown as enabled

This commit is contained in:
Rucha Mahabal 2020-01-29 11:33:29 +05:30
parent c7417c08ed
commit a4202d1660
7 changed files with 17 additions and 26 deletions

View File

@ -29,7 +29,7 @@ frappe.ui.form.on('Clinical Procedure', {
refresh: function(frm) {
frm.set_query("patient", function () {
return {
filters: {"disabled": 0}
filters: {"status": "Disabled"}
};
});
frm.set_query("appointment", function () {

View File

@ -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",

View File

@ -15,7 +15,7 @@ frappe.ui.form.on('Patient', {
} 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);
});

View File

@ -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,19 +183,8 @@
"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",
@ -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",

View File

@ -15,8 +15,8 @@ class Patient(Document):
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 @@ class Patient(Document):
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')

View File

@ -11,7 +11,7 @@ frappe.ui.form.on('Patient Appointment', {
refresh: function(frm) {
frm.set_query("patient", function () {
return {
filters: {"disabled": 0}
filters: {"status": "Disabled"}
};
});
frm.set_query("practitioner", function() {

View File

@ -62,7 +62,7 @@ frappe.ui.form.on('Patient Encounter', {
frm.set_query("patient", function () {
return {
filters: {"disabled": 0}
filters: {"status": "Disabled"}
};
});
frm.set_query("drug_code", "drug_prescription", function() {