Healthcare Service Unit - rename field - occupied to occupancy status

This commit is contained in:
Jamsheer 2018-07-30 16:07:19 +05:30
parent b19993b5bc
commit 2ae06d3a35
4 changed files with 17 additions and 15 deletions

View File

@ -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
}

View File

@ -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"
}
};
};

View File

@ -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()

View File

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