Skip to content

Instantly share code, notes, and snippets.

@MaxMorais
Created April 12, 2018 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaxMorais/d31b04eafe9fb58bae667a5da5c1f0bc to your computer and use it in GitHub Desktop.
Save MaxMorais/d31b04eafe9fb58bae667a5da5c1f0bc to your computer and use it in GitHub Desktop.
frappe.views.ReportView = frappe.views.ReportView.extend({
setup_print: function(){
this._super();
var me = this;
this.page.add_menu_item(__("Print via Print Node"), function(){
frappe.msgprint("Printing via Print Node");
}, true);
}
});
frappe.views.GridReport = frappe.views.GridReport.extend({
setup_filters: function(){
this._super();
var me = this;
this.page.add_menu_item(__("Print via Print Node"), function(){
frappe.msgprint("Printing via Print Node");
}, true);
}
});
frappe.views.QueryReport = frappe.views.QueryReport.extend({
make_toolbar: function(){
this._super();
var me = this,
item_selector = 'li > a.grey-link',
$li = $('<li><a class="grey-link">' + __("Print via Print Node") + "</a></li>" ),
$link = $li.find('a').on('click', function(){
frappe.msgprint("Printing via Print Node");
}),
$sibling = this.page.menu.find('li > a.grey-link:contains("' + __("Print") + '")').parent();
$li.insertAfter($sibling);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment