Merge pull request #24152 from ruchamahabal/fix-therapy-type-filter
fix: filter Therapy Types and Therapy Plan in Patient Appointment
This commit is contained in:
commit
e1b9707ec1
@ -22,6 +22,7 @@ frappe.ui.form.on('Patient Appointment', {
|
|||||||
filters: {'status': 'Active'}
|
filters: {'status': 'Active'}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query('practitioner', function() {
|
frm.set_query('practitioner', function() {
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@ -29,6 +30,7 @@ frappe.ui.form.on('Patient Appointment', {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query('service_unit', function(){
|
frm.set_query('service_unit', function(){
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
@ -39,6 +41,16 @@ frappe.ui.form.on('Patient Appointment', {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query('therapy_plan', function() {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'patient': frm.doc.patient
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
frm.trigger('set_therapy_type_filter');
|
||||||
|
|
||||||
if (frm.is_new()) {
|
if (frm.is_new()) {
|
||||||
frm.page.set_primary_action(__('Check Availability'), function() {
|
frm.page.set_primary_action(__('Check Availability'), function() {
|
||||||
if (!frm.doc.patient) {
|
if (!frm.doc.patient) {
|
||||||
@ -136,6 +148,24 @@ frappe.ui.form.on('Patient Appointment', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
therapy_plan: function(frm) {
|
||||||
|
frm.trigger('set_therapy_type_filter');
|
||||||
|
},
|
||||||
|
|
||||||
|
set_therapy_type_filter: function(frm) {
|
||||||
|
if (frm.doc.therapy_plan) {
|
||||||
|
frm.call('get_therapy_types').then(r => {
|
||||||
|
frm.set_query('therapy_type', function() {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'name': ['in', r.message]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
therapy_type: function(frm) {
|
therapy_type: function(frm) {
|
||||||
if (frm.doc.therapy_type) {
|
if (frm.doc.therapy_type) {
|
||||||
frappe.db.get_value('Therapy Type', frm.doc.therapy_type, 'default_duration', (r) => {
|
frappe.db.get_value('Therapy Type', frm.doc.therapy_type, 'default_duration', (r) => {
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
"procedure_template",
|
"procedure_template",
|
||||||
"get_procedure_from_encounter",
|
"get_procedure_from_encounter",
|
||||||
"procedure_prescription",
|
"procedure_prescription",
|
||||||
|
"therapy_plan",
|
||||||
"therapy_type",
|
"therapy_type",
|
||||||
"get_prescribed_therapies",
|
"get_prescribed_therapies",
|
||||||
"therapy_plan",
|
|
||||||
"practitioner",
|
"practitioner",
|
||||||
"practitioner_name",
|
"practitioner_name",
|
||||||
"department",
|
"department",
|
||||||
@ -284,7 +284,7 @@
|
|||||||
"report_hide": 1
|
"report_hide": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval:doc.patient;",
|
"depends_on": "eval:doc.patient && doc.therapy_plan;",
|
||||||
"fieldname": "therapy_type",
|
"fieldname": "therapy_type",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Therapy",
|
"label": "Therapy",
|
||||||
@ -292,17 +292,16 @@
|
|||||||
"set_only_once": 1
|
"set_only_once": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval:doc.patient && doc.__islocal;",
|
"depends_on": "eval:doc.patient && doc.therapy_plan && doc.__islocal;",
|
||||||
"fieldname": "get_prescribed_therapies",
|
"fieldname": "get_prescribed_therapies",
|
||||||
"fieldtype": "Button",
|
"fieldtype": "Button",
|
||||||
"label": "Get Prescribed Therapies"
|
"label": "Get Prescribed Therapies"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval: doc.patient && doc.therapy_type",
|
"depends_on": "eval: doc.patient;",
|
||||||
"fieldname": "therapy_plan",
|
"fieldname": "therapy_plan",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Therapy Plan",
|
"label": "Therapy Plan",
|
||||||
"mandatory_depends_on": "eval: doc.patient && doc.therapy_type",
|
|
||||||
"options": "Therapy Plan"
|
"options": "Therapy Plan"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -348,7 +347,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-05-21 03:04:21.400893",
|
"modified": "2020-12-16 13:16:58.578503",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Healthcare",
|
"module": "Healthcare",
|
||||||
"name": "Patient Appointment",
|
"name": "Patient Appointment",
|
||||||
|
@ -91,6 +91,17 @@ class PatientAppointment(Document):
|
|||||||
if fee_validity:
|
if fee_validity:
|
||||||
frappe.msgprint(_('{0} has fee validity till {1}').format(self.patient, fee_validity.valid_till))
|
frappe.msgprint(_('{0} has fee validity till {1}').format(self.patient, fee_validity.valid_till))
|
||||||
|
|
||||||
|
def get_therapy_types(self):
|
||||||
|
if not self.therapy_plan:
|
||||||
|
return
|
||||||
|
|
||||||
|
therapy_types = []
|
||||||
|
doc = frappe.get_doc('Therapy Plan', self.therapy_plan)
|
||||||
|
for entry in doc.therapy_plan_details:
|
||||||
|
therapy_types.append(entry.therapy_type)
|
||||||
|
|
||||||
|
return therapy_types
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def check_payment_fields_reqd(patient):
|
def check_payment_fields_reqd(patient):
|
||||||
@ -145,7 +156,7 @@ def invoice_appointment(appointment_doc):
|
|||||||
sales_invoice.flags.ignore_mandatory = True
|
sales_invoice.flags.ignore_mandatory = True
|
||||||
sales_invoice.save(ignore_permissions=True)
|
sales_invoice.save(ignore_permissions=True)
|
||||||
sales_invoice.submit()
|
sales_invoice.submit()
|
||||||
frappe.msgprint(_('Sales Invoice {0} created'.format(sales_invoice.name)), alert=True)
|
frappe.msgprint(_('Sales Invoice {0} created').format(sales_invoice.name), alert=True)
|
||||||
frappe.db.set_value('Patient Appointment', appointment_doc.name, 'invoiced', 1)
|
frappe.db.set_value('Patient Appointment', appointment_doc.name, 'invoiced', 1)
|
||||||
frappe.db.set_value('Patient Appointment', appointment_doc.name, 'ref_sales_invoice', sales_invoice.name)
|
frappe.db.set_value('Patient Appointment', appointment_doc.name, 'ref_sales_invoice', sales_invoice.name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user