fix: set default letterhead and print format

This commit is contained in:
Dany Robert 2023-04-26 14:04:03 +00:00
parent 109a549a23
commit d00bfcdc12

View file

@ -9,6 +9,7 @@ export default class BulkOperations {
const allow_print_for_draft = cint(print_settings.allow_print_for_draft);
const is_submittable = frappe.model.is_submittable(this.doctype);
const allow_print_for_cancelled = cint(print_settings.allow_print_for_cancelled);
const letterheads = this.get_letterhead_options();
const valid_docs = docs
.filter((doc) => {
@ -41,14 +42,15 @@ export default class BulkOperations {
fieldtype: "Select",
label: __("Letter Head"),
fieldname: "letter_sel",
default: __("No Letterhead"),
options: this.get_letterhead_options(),
options: letterheads,
default: letterheads[0],
},
{
fieldtype: "Select",
label: __("Print Format"),
fieldname: "print_sel",
options: frappe.meta.get_print_formats(this.doctype),
default: frappe.get_meta(this.doctype).default_print_format
},
{
fieldtype: "Select",
@ -127,13 +129,18 @@ export default class BulkOperations {
args: {
doctype: "Letter Head",
fields: ["name", "is_default"],
filters: {"disabled": 0},
limit_page_length: 0,
},
async: false,
callback(r) {
if (r.message) {
r.message.forEach((letterhead) => {
letterhead_options.push(letterhead.name);
if (letterhead.is_default) {
letterhead_options.unshift(letterhead.name);
} else {
letterhead_options.push(letterhead.name);
}
});
}
},