I had disabled the Allow Print for Draft in the print settings, however I need to allow print for draft for only certain documents. Any possibility to achieve this either using client script or any other methods.
Hi @Rahul-R,
First, enable the Allow Print for Draft in Print Setting.
If don’t want to print in the Draft stage then apply it in a particular doctype.
Here we set in Purchase Order DocType.
So apply the client script.
frappe.ui.form.on('Purchase Order', {
refresh: function(frm) {
if(frm.doc.docstatus != 1) {
$("button[data-original-title=Print]").hide();
frm.page.menu.find('[data-label="Print"]').parent().parent().remove();
}
}
});
Also, remove the print option from the Menu list.
Output:
In Draft Stage:
After Submit:
Another Reference:
I hope this helps.
Thank You!
3 Likes