From 5843aae5f68fc7ea7a3f574ded9df82b7a00f851 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Sun, 13 Nov 2022 23:28:05 +0100 Subject: [PATCH] fix: set default print format --- frappe/printing/page/print/print.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frappe/printing/page/print/print.js b/frappe/printing/page/print/print.js index 6584cdc40a..2d9ce5ed47 100644 --- a/frappe/printing/page/print/print.js +++ b/frappe/printing/page/print/print.js @@ -712,14 +712,14 @@ frappe.ui.form.PrintView = class { } refresh_print_options() { - this.print_formats = frappe.meta.get_print_formats(this.frm.doctype); - const print_format_select_val = this.print_sel.val(); - this.print_sel.empty(); + if ( + frappe.meta.get_print_formats(this.frm.doctype).includes(this.print_sel.val()) || + !this.frm.meta.default_print_format + ) + return; - return ( - this.print_formats.includes(print_format_select_val) && - this.print_sel.val(print_format_select_val) - ); + this.print_sel.empty(); + this.print_sel.val(this.frm.meta.default_print_format); } selected_format() { @@ -778,7 +778,7 @@ frappe.ui.form.PrintView = class { fieldtype: "Select", fieldname: "print_format", default: 0, - options: this.print_formats, + options: frappe.meta.get_print_formats(this.frm.doctype), read_only: 0, in_list_view: 1, label: __("Print Format"),