Is there a way to add an action to a button that’s been added on a query report.
I have customized my report to have a button using the following code (In my report_name.js file):
{
“fieldname”:“myCoolButton”,
“label”: __(“Select Supplier”),
“fieldtype”: “Button”,
“options”: “”,
“default”: “”
}
I can’t seem to find a way to attach a function to it that gets called when it is clicked. cur_frm doesn’t exist in Query Reports and I can’t use form.ui.on() because there is not really a doctype associated (this isn’t a form). I couldn’t see anything in frappe.query_report that makes sense.
This is a tough one, but anyone have suggestions?
rmehta
August 12, 2016, 5:31am
#2
Don’t add the button to filters, see this:
period_start_date: fy.year_start_date,
period_end_date: fy.year_end_date
});
});
const views_menu = report.page.add_custom_button_group(__('Financial Statements'));
report.page.add_custom_menu_item(views_menu, __("Balance Sheet"), function() {
var filters = report.get_values();
frappe.set_route('query-report', 'Balance Sheet', {company: filters.company});
});
report.page.add_custom_menu_item(views_menu, __("Profit and Loss"), function() {
var filters = report.get_values();
frappe.set_route('query-report', 'Profit and Loss Statement', {company: filters.company});
});
report.page.add_custom_menu_item(views_menu, __("Cash Flow Statement"), function() {
var filters = report.get_values();
frappe.set_route('query-report', 'Cash Flow', {company: filters.company});
});
1 Like