Skip to content

Commit

Permalink
fix(Clinical Procedure): consumables table not loading on template ch…
Browse files Browse the repository at this point in the history
…ange
  • Loading branch information
akashkrishna619 committed Mar 7, 2024
1 parent 43546a1 commit b89277a
Showing 1 changed file with 28 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,12 @@ frappe.ui.form.on('Clinical Procedure', {
frm.set_value('consume_stock', data.message.consume_stock);
frm.events.set_warehouse(frm);
frm.events.set_procedure_consumables(frm);
frm.events.set_medical_codes(frm);
}
});
} else {
frm.clear_table("codification_table")
frm.refresh_field("codification_table");
}
},

Expand Down Expand Up @@ -341,39 +345,31 @@ frappe.ui.form.on('Clinical Procedure', {
});
},

procedure_template: function(frm) {
if (frm.doc.procedure_template) {
frappe.call({
"method": "healthcare.healthcare.utils.get_medical_codes",
args: {
template_dt: "Clinical Procedure Template",
template_dn: frm.doc.procedure_template,
},
callback: function(r) {
if (!r.exc && r.message) {
frm.doc.codification_table = []
$.each(r.message, function(k, val) {
if (val.code_value) {
var child = cur_frm.add_child("codification_table");
child.code_value = val.code_value
child.code_system = val.code_system
child.code = val.code
child.description = val.description
child.system = val.system
}
});
frm.refresh_field("codification_table");
} else {
frm.clear_table("codification_table")
frm.refresh_field("codification_table");
}
set_medical_codes: function(frm) {
frappe.call({
"method": "healthcare.healthcare.utils.get_medical_codes",
args: {
template_dt: "Clinical Procedure Template",
template_dn: frm.doc.procedure_template,
},
callback: function(r) {
if (!r.exc && r.message) {
frm.doc.codification_table = []
$.each(r.message, function(k, val) {
if (val.code_value) {
var child = cur_frm.add_child("codification_table");
child.code_value = val.code_value
child.code_system = val.code_system
child.code = val.code
child.description = val.description
child.system = val.system
}
});
frm.refresh_field("codification_table");
}
})
} else {
frm.clear_table("codification_table")
frm.refresh_field("codification_table");
}
}
}
})
},

});

Expand Down

0 comments on commit b89277a

Please sign in to comment.