Merge pull request #11099 from anupamvs/print-format
fix: print format custom button
This commit is contained in:
commit
47735c3629
1 changed files with 14 additions and 7 deletions
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue