|
|
@@ -36,21 +36,23 @@ frappe.ui.form.on("Print Format", { |
|
|
|
else if (frm.doc.custom_format && !frm.doc.raw_printing) { |
|
|
|
frm.set_df_property("html", "reqd", 1); |
|
|
|
} |
|
|
|
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(); |
|
|
|
} |
|
|
|
if (frappe.perm.has_perm('DocType', 0, 'read', frm.doc.doc_type)) { |
|
|
|
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(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
custom_format: function (frm) { |
|
|
|