Healthcare Service Unit - rename field - occupied to occupancy status
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 945817c..a7e6932 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 936c682..67c12f6 100644
--- a/erpnext/healthcare/doctype/inpatient_record/inpatient_record.js
+++ b/erpnext/healthcare/doctype/inpatient_record/inpatient_record.js
@@ -94,7 +94,7 @@
filters: {
"is_group": 0,
"service_unit_type": dialog.get_value("service_unit_type"),
- "occupied" : 0
+ "occupancy_status" : "Vacant"
}
};
};
@@ -166,7 +166,7 @@
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 2d928c6..c107cd7 100644
--- a/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py
+++ b/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py
@@ -88,7 +88,7 @@
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 @@
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 @@
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 f912ddb..8849748 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 @@
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 @@
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",