Skip to content

Commit

Permalink
fix: set default letterhead and print format
Browse files Browse the repository at this point in the history
(cherry picked from commit d00bfcd)
  • Loading branch information
rtdany10 authored and mergify[bot] committed May 5, 2023
1 parent 1a8e671 commit a5a6965
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions frappe/public/js/frappe/list/bulk_operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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);
}
});
}
},
Expand Down

0 comments on commit a5a6965

Please sign in to comment.