ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Printing a single type doctype


#1

Is there a way to add a print button to a Single type doctype?


#2

Yes my friend here is the code, change the doctype name, buttom name and print format name

    frappe.ui.form.on("Sales Invoice",{
    refresh: function(frm) {

frm.add_custom_button(__("Factura"), function() {
            var w = window.open("/printview?doctype=Sales%20Invoice&name=" + cur_frm.doc.name + "&trigger_print=1&format=Matricial%20Ajustada&no_letterhead=0&_lang=es");

            if(!w) {
                frappe.msgprint(__("Please enable pop-ups")); return;
            }
                })
}});

#3

This works perfectly!
Thank you so much!


#4