feat: Allow selecting admission service unit in Patient Appointment for inpatients

This commit is contained in:
Rucha Mahabal
2021-01-18 14:56:55 +05:30
parent ea19434af4
commit 20e5315480
3 changed files with 34 additions and 6 deletions

View File

@@ -264,7 +264,7 @@ def get_filters(entry):
def get_current_healthcare_service_unit(inpatient_record):
ip_record = frappe.get_doc('Inpatient Record', inpatient_record)
if ip_record.inpatient_occupancies:
if ip_record.status in ['Admitted', 'Discharge Scheduled'] and ip_record.inpatient_occupancies:
return ip_record.inpatient_occupancies[-1].service_unit
return

View File

@@ -31,14 +31,14 @@ frappe.ui.form.on('Patient Appointment', {
};
});
frm.set_query('service_unit', function(){
frm.set_query('service_unit', function() {
return {
query: 'erpnext.controllers.queries.get_healthcare_service_units',
filters: {
'is_group': false,
'allow_appointments': true,
'company': frm.doc.company
company: frm.doc.company,
inpatient_record: frm.doc.inpatient_record
}
};
}
});
frm.set_query('therapy_plan', function() {