Merge pull request #23799 from ruchamahabal/fix-ipme

fix: Inpatient Medication Order and Entry fixes
This commit is contained in:
Rucha Mahabal 2020-11-03 15:43:06 +05:30 committed by GitHub
commit b7e84f70c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 3 deletions

View File

@ -21,6 +21,19 @@ frappe.ui.form.on('Inpatient Medication Entry', {
} }
}; };
}); });
frm.set_query('warehouse', () => {
return {
filters: {
company: frm.doc.company
}
};
});
},
patient: function(frm) {
if (frm.doc.patient)
frm.set_value('service_unit', '');
}, },
get_medication_orders: function(frm) { get_medication_orders: function(frm) {

View File

@ -67,6 +67,7 @@
}, },
{ {
"collapsible": 1, "collapsible": 1,
"collapsible_depends_on": "eval: doc.__islocal",
"fieldname": "filters_section", "fieldname": "filters_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Filters" "label": "Filters"
@ -93,6 +94,7 @@
"options": "Patient" "options": "Patient"
}, },
{ {
"depends_on": "eval:!doc.patient",
"fieldname": "service_unit", "fieldname": "service_unit",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Healthcare Service Unit", "label": "Healthcare Service Unit",
@ -178,7 +180,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-09-30 23:40:45.528715", "modified": "2020-11-03 13:22:37.820707",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Inpatient Medication Entry", "name": "Inpatient Medication Entry",

View File

@ -199,6 +199,7 @@ class InpatientMedicationEntry(Document):
def get_pending_medication_orders(entry): def get_pending_medication_orders(entry):
filters, values = get_filters(entry) filters, values = get_filters(entry)
to_remove = []
data = frappe.db.sql(""" data = frappe.db.sql("""
SELECT SELECT
@ -225,6 +226,9 @@ def get_pending_medication_orders(entry):
doc['service_unit'] = get_current_healthcare_service_unit(inpatient_record) doc['service_unit'] = get_current_healthcare_service_unit(inpatient_record)
if entry.service_unit and doc.service_unit != entry.service_unit: if entry.service_unit and doc.service_unit != entry.service_unit:
to_remove.append(doc)
for doc in to_remove:
data.remove(doc) data.remove(doc)
return data return data

View File

@ -12,7 +12,8 @@ frappe.ui.form.on('Inpatient Medication Order', {
frm.set_query('patient', () => { frm.set_query('patient', () => {
return { return {
filters: { filters: {
'inpatient_record': ['!=', ''] 'inpatient_record': ['!=', ''],
'inpatient_status': 'Admitted'
} }
}; };
}); });