Skip to content

Commit

Permalink
fix: update client script to set default formats.
Browse files Browse the repository at this point in the history
This is initially done on the client script as it is implicit.
user can always choose different formats.

after sometime will make them default on the server side.
  • Loading branch information
maharshivpatel committed Apr 2, 2024
1 parent c479228 commit 3bf8c5a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions print_designer/print_designer/client_scripts/print.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: revisit and properly implement this client script
frappe.pages["print"].on_page_load = function (wrapper) {
frappe.require(["pdfjs.bundle.css", "print_designer.bundle.css"]);
frappe.ui.make_app_page({
Expand Down Expand Up @@ -398,10 +399,15 @@ frappe.ui.form.PrintView = class PrintView extends frappe.ui.form.PrintView {
if (
frappe.meta
.get_print_formats(this.frm.doctype)
.includes(this.toolbar_print_format_selector.$input.val()) ||
!this.frm.meta.default_print_format
.includes(this.toolbar_print_format_selector.$input.val())
)
return;
if (!this.frm.meta.default_print_format) {
if (this.frm.doctype != "Sales Invoice") return;
this.print_format_selector.val("Sales Invoice PD Format v2");
this.toolbar_print_format_selector.$input.val("Sales Invoice PD Format v2");
return;
}
this.toolbar_print_format_selector.$input.empty();
this.toolbar_print_format_selector.$input.val(this.frm.meta.default_print_format);
}
Expand Down

0 comments on commit 3bf8c5a

Please sign in to comment.