Merge pull request #11099 from anupamvs/print-format

fix: print format custom button
This commit is contained in:
mergify[bot] 2020-07-29 13:57:30 +00:00 committed by GitHub
commit 47735c3629
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,13 +35,20 @@ frappe.ui.form.on("Print Format", {
else if (frm.doc.custom_format && !frm.doc.raw_printing) {
frm.set_df_property("html", "reqd", 1);
}
frm.add_custom_button(__("Make Default"), function () {
frappe.call({
method: "frappe.printing.doctype.print_format.print_format.make_default",
args: {
name: frm.doc.name
}
})
frappe.db.get_value('DocType', frm.doc.doc_type, 'default_print_format', (r) => {
if (r.default_print_format != frm.doc.name) {
frm.add_custom_button(__("Set as Default"), function () {
frappe.call({
method: "frappe.printing.doctype.print_format.print_format.make_default",
args: {
name: frm.doc.name
},
callback: function() {
frm.refresh();
}
});
});
}
});
}
},