From 2ae06d3a352d766b897f6a4ecd0e69105c8d69fa Mon Sep 17 00:00:00 2001 From: Jamsheer Date: Mon, 30 Jul 2018 16:07:19 +0530 Subject: [PATCH] Healthcare Service Unit - rename field - occupied to occupancy status --- .../healthcare_service_unit.json | 16 +++++++++------- .../doctype/inpatient_record/inpatient_record.js | 4 ++-- .../doctype/inpatient_record/inpatient_record.py | 6 +++--- .../inpatient_record/test_inpatient_record.py | 6 +++--- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/erpnext/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.json b/erpnext/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.json index 945817c8d3..a7e69329de 100644 --- a/erpnext/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.json +++ b/erpnext/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.json @@ -43,7 +43,7 @@ "search_index": 0, "set_only_once": 0, "translatable": 0, - "unique": 0 + "unique": 1 }, { "allow_bulk_edit": 0, @@ -258,10 +258,10 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "0", + "default": "", "depends_on": "eval:doc.inpatient_occupancy == 1", - "fieldname": "occupied", - "fieldtype": "Check", + "fieldname": "occupancy_status", + "fieldtype": "Select", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -269,9 +269,10 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Occupied", + "label": "Occupancy Status", "length": 0, "no_copy": 1, + "options": "Vacant\nOccupied", "permlevel": 0, "precision": "", "print_hide": 0, @@ -460,7 +461,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-07-17 17:40:18.867327", + "modified": "2018-07-30 15:09:57.016256", "modified_by": "Administrator", "module": "Healthcare", "name": "Healthcare Service Unit", @@ -535,5 +536,6 @@ "sort_order": "DESC", "title_field": "healthcare_service_unit_name", "track_changes": 1, - "track_seen": 0 + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/healthcare/doctype/inpatient_record/inpatient_record.js b/erpnext/healthcare/doctype/inpatient_record/inpatient_record.js index 936c682dca..67c12f6c14 100644 --- a/erpnext/healthcare/doctype/inpatient_record/inpatient_record.js +++ b/erpnext/healthcare/doctype/inpatient_record/inpatient_record.js @@ -94,7 +94,7 @@ var admit_patient_dialog = function(frm){ filters: { "is_group": 0, "service_unit_type": dialog.get_value("service_unit_type"), - "occupied" : 0 + "occupancy_status" : "Vacant" } }; }; @@ -166,7 +166,7 @@ var transfer_patient_dialog = function(frm){ filters: { "is_group": 0, "service_unit_type": dialog.get_value("service_unit_type"), - "occupied" : 0 + "occupancy_status" : "Vacant" } }; }; diff --git a/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py b/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py index 2d928c6c9e..c107cd7335 100644 --- a/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py +++ b/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py @@ -88,7 +88,7 @@ def check_out_inpatient(inpatient_record): if inpatient_occupancy.left != 1: inpatient_occupancy.left = True inpatient_occupancy.check_out = now_datetime() - frappe.db.set_value("Healthcare Service Unit", inpatient_occupancy.service_unit, "occupied", False) + frappe.db.set_value("Healthcare Service Unit", inpatient_occupancy.service_unit, "occupancy_status", "Vacant") def discharge_patient(inpatient_record): validate_invoiced_inpatient(inpatient_record) @@ -156,7 +156,7 @@ def transfer_patient(inpatient_record, service_unit, check_in): inpatient_record.save(ignore_permissions = True) - frappe.db.set_value("Healthcare Service Unit", service_unit, "occupied", True) + frappe.db.set_value("Healthcare Service Unit", service_unit, "occupancy_status", "Occupied") def patient_leave_service_unit(inpatient_record, check_out, leave_from): if inpatient_record.inpatient_occupancies: @@ -164,7 +164,7 @@ def patient_leave_service_unit(inpatient_record, check_out, leave_from): if inpatient_occupancy.left != 1 and inpatient_occupancy.service_unit == leave_from: inpatient_occupancy.left = True inpatient_occupancy.check_out = check_out - frappe.db.set_value("Healthcare Service Unit", inpatient_occupancy.service_unit, "occupied", False) + frappe.db.set_value("Healthcare Service Unit", inpatient_occupancy.service_unit, "occupancy_status", "Vacant") inpatient_record.save(ignore_permissions = True) @frappe.whitelist() diff --git a/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py b/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py index f912ddb043..884974853d 100644 --- a/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py +++ b/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py @@ -23,11 +23,11 @@ class TestInpatientRecord(unittest.TestCase): service_unit = get_healthcare_service_unit() admit_patient(ip_record, service_unit, now_datetime()) self.assertEqual("Admitted", frappe.db.get_value("Patient", patient, "inpatient_status")) - self.assertEqual(1, frappe.db.get_value("Healthcare Service Unit", service_unit, "occupied")) + self.assertEqual("Occupied", frappe.db.get_value("Healthcare Service Unit", service_unit, "occupancy_status")) # Discharge schedule_discharge(patient=patient) - self.assertEqual(0, frappe.db.get_value("Healthcare Service Unit", service_unit, "occupied")) + self.assertEqual("Vacant", frappe.db.get_value("Healthcare Service Unit", service_unit, "occupancy_status")) ip_record1 = frappe.get_doc("Inpatient Record", ip_record.name) # Validate Pending Invoices @@ -93,7 +93,7 @@ def get_healthcare_service_unit(): service_unit.healthcare_service_unit_name = "Test Service Unit Ip Occupancy" service_unit.service_unit_type = get_service_unit_type() service_unit.inpatient_occupancy = 1 - service_unit.occupied = 0 + service_unit.occupancy_status = "Vacant" service_unit.is_group = 0 service_unit_parent_name = frappe.db.exists({ "doctype": "Healthcare Service Unit",