Hello all
I’m trying to add a client-side custom script which will display a custom button on the Quotation Items child table:
frappe.ui.form.on('Quotation Item', 'refresh', function(frm) {
frm.add_custom_button(__("Do Something"), function() {
alert("button");
});
});
1 However this code never executes! Why not?
2 is it possible to add a button on the child table, not on the parent (Quotation), eg next to Download
Thanks so much
2 Likes
sanjay
January 20, 2021, 3:15pm
2
frappe.ui.form.on(‘Quotation’, ‘refresh’, function(frm) {
frm.doc[“items”].grid.add_custom_button(__(“Do Something”), function() {
alert(“button”);
});
});
1 Like
Ah… @sanjay , I was so close to marking this as the solution (and giving you a like), but then I thought “let me first test it”.
I’m afraid the “Do Something” button does not show, but worse, I also loose the “Get items from” button on the top of the Quotation and the “Add Multiple” button on the Quote Items grid.
sanjay
January 21, 2021, 5:05am
4
My apologies, below is working code:
frappe.ui.form.on('Quotation', {
refresh(frm) {
frm.fields_dict["items"].grid.add_custom_button(__('Hello'),
function() {
frappe.msgprint(__("Hello"));
});
frm.fields_dict["items"].grid.grid_buttons.find('.btn-custom').removeClass('btn-default').addClass('btn-primary');
}
})
9 Likes
You’ve earned it!
Thanks so much
1 Like