i have created single doctype named Despatch Labels, but this doctype don’t have print button
how to enable it anyone knows ?
i have created single doctype named Despatch Labels, but this doctype don’t have print button
how to enable it anyone knows ?
I think for Single Doctype there is no options to print
Did you get any solution ?
frappe.ui.form.on('Doctype_Name', {
refresh: function(frm) {
frm.add_custom_button(__('Print'), function() {
navigateToPrintFormatUI(frm);
});
}
});
function navigateToPrintFormatUI(frm) {
var docName = frm.doc.name;
var doctype = 'Doctype_Name';
var printFormatUrl = `/app/print/${encodeURIComponent(doctype)}/${encodeURIComponent(docName)}`;
window.location.href = frappe.urllib.get_full_url(printFormatUrl);
}
please give me the reply if code not working
thank you
If you press the Ctrl + P its directly take you to the Print Page
. I hope this may help even more better.
that shortcut is printing a page which you viewing, i have barcode printer and my sticker size is 50 x 100 mm, that’s why i make print format according my requirement and make print only those field which i want print
thank for suggestion @Antony_Praveenkumar
Great answer @nilpatel42, this is a simplified version using native code
frappe.ui.form.on('Open Transactions', {
refresh(frm) {
frm.add_custom_button(__("Print"), function() {frm.print_doc()});
}
});