diff --git a/healthcare/healthcare/doctype/healthcare_settings/healthcare_settings.py b/healthcare/healthcare/doctype/healthcare_settings/healthcare_settings.py index 5922d9c29c..bd36df8647 100644 --- a/healthcare/healthcare/doctype/healthcare_settings/healthcare_settings.py +++ b/healthcare/healthcare/doctype/healthcare_settings/healthcare_settings.py @@ -46,10 +46,10 @@ def get_sms_text(doc): doc = frappe.get_doc("Lab Test", doc) context = {"doc": doc, "alert": doc, "comments": None} - emailed = frappe.db.get_value("Healthcare Settings", None, "sms_emailed") + emailed = frappe.db.get_single_value("Healthcare Settings", "sms_emailed") sms_text["emailed"] = frappe.render_template(emailed, context) - printed = frappe.db.get_value("Healthcare Settings", None, "sms_printed") + printed = frappe.db.get_single_value("Healthcare Settings", "sms_printed") sms_text["printed"] = frappe.render_template(printed, context) return sms_text diff --git a/healthcare/healthcare/doctype/patient_appointment/test_patient_appointment.py b/healthcare/healthcare/doctype/patient_appointment/test_patient_appointment.py index fd5fa539f0..a8d8db0ea9 100644 --- a/healthcare/healthcare/doctype/patient_appointment/test_patient_appointment.py +++ b/healthcare/healthcare/doctype/patient_appointment/test_patient_appointment.py @@ -31,7 +31,7 @@ def setUp(self): def test_status(self): patient, practitioner = create_healthcare_docs() - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 0) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 0) appointment = create_appointment(patient, practitioner, nowdate()) self.assertEqual(appointment.status, "Open") appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2)) @@ -45,7 +45,7 @@ def test_status(self): def test_start_encounter(self): patient, practitioner = create_healthcare_docs() - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 1) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 1) appointment = create_appointment(patient, practitioner, add_days(nowdate(), 4), invoice=1) appointment.reload() self.assertEqual(appointment.invoiced, 1) @@ -61,12 +61,12 @@ def test_start_encounter(self): def test_auto_invoicing(self): patient, practitioner = create_healthcare_docs() - frappe.db.set_value("Healthcare Settings", None, "enable_free_follow_ups", 0) - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 0) + frappe.db.set_single_value("Healthcare Settings", "enable_free_follow_ups", 0) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 0) appointment = create_appointment(patient, practitioner, nowdate()) self.assertEqual(frappe.db.get_value("Patient Appointment", appointment.name, "invoiced"), 0) - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 1) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 1) appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2), invoice=1) self.assertEqual(frappe.db.get_value("Patient Appointment", appointment.name, "invoiced"), 1) sales_invoice_name = frappe.db.get_value( @@ -86,8 +86,8 @@ def test_auto_invoicing(self): def test_auto_invoicing_based_on_department(self): patient, practitioner = create_healthcare_docs() medical_department = create_medical_department() - frappe.db.set_value("Healthcare Settings", None, "enable_free_follow_ups", 0) - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 1) + frappe.db.set_single_value("Healthcare Settings", "enable_free_follow_ups", 0) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 1) appointment_type = create_appointment_type({"medical_department": medical_department}) appointment = create_appointment( @@ -114,8 +114,8 @@ def test_auto_invoicing_based_on_department(self): def test_auto_invoicing_according_to_appointment_type_charge(self): patient, practitioner = create_healthcare_docs() - frappe.db.set_value("Healthcare Settings", None, "enable_free_follow_ups", 0) - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 1) + frappe.db.set_single_value("Healthcare Settings", "enable_free_follow_ups", 0) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 1) item = create_healthcare_service_items() items = [{"op_consulting_charge_item": item, "op_consulting_charge": 300}] @@ -139,7 +139,7 @@ def test_auto_invoicing_according_to_appointment_type_charge(self): def test_appointment_cancel(self): patient, practitioner = create_healthcare_docs() - frappe.db.set_value("Healthcare Settings", None, "enable_free_follow_ups", 1) + frappe.db.set_single_value("Healthcare Settings", "enable_free_follow_ups", 1) appointment = create_appointment(patient, practitioner, nowdate()) fee_validity = frappe.db.get_value( "Fee Validity", {"patient": patient, "practitioner": practitioner} @@ -155,8 +155,8 @@ def test_appointment_cancel(self): # check fee validity updated self.assertEqual(frappe.db.get_value("Fee Validity", fee_validity, "visited"), 0) - frappe.db.set_value("Healthcare Settings", None, "enable_free_follow_ups", 0) - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 1) + frappe.db.set_single_value("Healthcare Settings", "enable_free_follow_ups", 0) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 1) appointment = create_appointment(patient, practitioner, add_days(nowdate(), 1), invoice=1) update_status(appointment.name, "Cancelled") # check invoice cancelled @@ -237,10 +237,10 @@ def test_invalid_healthcare_service_unit_validation(self): discharge_patient(ip_record1) def test_payment_should_be_mandatory_for_new_patient_appointment(self): - frappe.db.set_value("Healthcare Settings", None, "enable_free_follow_ups", 1) - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 1) - frappe.db.set_value("Healthcare Settings", None, "max_visits", 3) - frappe.db.set_value("Healthcare Settings", None, "valid_days", 30) + frappe.db.set_single_value("Healthcare Settings", "enable_free_follow_ups", 1) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 1) + frappe.db.set_single_value("Healthcare Settings", "max_visits", 3) + frappe.db.set_single_value("Healthcare Settings", "valid_days", 30) patient = create_patient() assert check_is_new_patient(patient) @@ -249,7 +249,7 @@ def test_payment_should_be_mandatory_for_new_patient_appointment(self): def test_sales_invoice_should_be_generated_for_new_patient_appointment(self): patient, practitioner = create_healthcare_docs() - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 1) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 1) invoice_count = frappe.db.count("Sales Invoice") assert check_is_new_patient(patient) @@ -449,8 +449,8 @@ def create_appointment( department=None, ): item = create_healthcare_service_items() - frappe.db.set_value("Healthcare Settings", None, "inpatient_visit_charge_item", item) - frappe.db.set_value("Healthcare Settings", None, "op_consulting_charge_item", item) + frappe.db.set_single_value("Healthcare Settings", "inpatient_visit_charge_item", item) + frappe.db.set_single_value("Healthcare Settings", "op_consulting_charge_item", item) appointment = frappe.new_doc("Patient Appointment") appointment.patient = patient appointment.practitioner = practitioner diff --git a/healthcare/healthcare/doctype/patient_medical_record/test_patient_medical_record.py b/healthcare/healthcare/doctype/patient_medical_record/test_patient_medical_record.py index f2d5dc7715..1440dd1913 100644 --- a/healthcare/healthcare/doctype/patient_medical_record/test_patient_medical_record.py +++ b/healthcare/healthcare/doctype/patient_medical_record/test_patient_medical_record.py @@ -18,8 +18,8 @@ class TestPatientMedicalRecord(FrappeTestCase): def setUp(self): - frappe.db.set_value("Healthcare Settings", None, "enable_free_follow_ups", 0) - frappe.db.set_value("Healthcare Settings", None, "automate_appointment_invoicing", 1) + frappe.db.set_single_value("Healthcare Settings", "enable_free_follow_ups", 0) + frappe.db.set_single_value("Healthcare Settings", "automate_appointment_invoicing", 1) make_pos_profile() def test_medical_record(self):