fix: allow medication entries to be deleted from the table
This commit is contained in:
parent
298e2fe9a5
commit
aff3f611d3
@ -5,6 +5,7 @@ frappe.ui.form.on('Inpatient Medication Entry', {
|
|||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
// Ignore cancellation of doctype on cancel all
|
// Ignore cancellation of doctype on cancel all
|
||||||
frm.ignore_doctypes_on_cancel_all = ['Stock Entry'];
|
frm.ignore_doctypes_on_cancel_all = ['Stock Entry'];
|
||||||
|
frm.fields_dict['medication_orders'].grid.wrapper.find('.grid-add-row').hide();
|
||||||
|
|
||||||
frm.set_query('item_code', () => {
|
frm.set_query('item_code', () => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -139,7 +139,6 @@
|
|||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"label": "Inpatient Medication Orders",
|
"label": "Inpatient Medication Orders",
|
||||||
"options": "Inpatient Medication Entry Detail",
|
"options": "Inpatient Medication Entry Detail",
|
||||||
"read_only": 1,
|
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -180,7 +179,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-11-03 13:22:37.820707",
|
"modified": "2021-01-11 12:37:46.749659",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Healthcare",
|
"module": "Healthcare",
|
||||||
"name": "Inpatient Medication Entry",
|
"name": "Inpatient Medication Entry",
|
||||||
|
|||||||
@ -15,8 +15,6 @@ class InpatientMedicationEntry(Document):
|
|||||||
self.validate_medication_orders()
|
self.validate_medication_orders()
|
||||||
|
|
||||||
def get_medication_orders(self):
|
def get_medication_orders(self):
|
||||||
self.validate_datetime_filters()
|
|
||||||
|
|
||||||
# pull inpatient medication orders based on selected filters
|
# pull inpatient medication orders based on selected filters
|
||||||
orders = get_pending_medication_orders(self)
|
orders = get_pending_medication_orders(self)
|
||||||
|
|
||||||
@ -27,22 +25,6 @@ class InpatientMedicationEntry(Document):
|
|||||||
self.set('medication_orders', [])
|
self.set('medication_orders', [])
|
||||||
frappe.msgprint(_('No pending medication orders found for selected criteria'))
|
frappe.msgprint(_('No pending medication orders found for selected criteria'))
|
||||||
|
|
||||||
def validate_datetime_filters(self):
|
|
||||||
if self.from_date and self.to_date:
|
|
||||||
self.validate_from_to_dates('from_date', 'to_date')
|
|
||||||
|
|
||||||
if self.from_date and getdate(self.from_date) > getdate():
|
|
||||||
frappe.throw(_('From Date cannot be after the current date.'))
|
|
||||||
|
|
||||||
if self.to_date and getdate(self.to_date) > getdate():
|
|
||||||
frappe.throw(_('To Date cannot be after the current date.'))
|
|
||||||
|
|
||||||
if self.from_time and self.from_time > nowtime():
|
|
||||||
frappe.throw(_('From Time cannot be after the current time.'))
|
|
||||||
|
|
||||||
if self.to_time and self.to_time > nowtime():
|
|
||||||
frappe.throw(_('To Time cannot be after the current time.'))
|
|
||||||
|
|
||||||
def add_mo_to_table(self, orders):
|
def add_mo_to_table(self, orders):
|
||||||
# Add medication orders in the child table
|
# Add medication orders in the child table
|
||||||
self.set('medication_orders', [])
|
self.set('medication_orders', [])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user