From b04af618f2ffe334ffa308bb3beb2cbe513542c2 Mon Sep 17 00:00:00 2001 From: Vishal Dhayagude Date: Wed, 8 Jun 2022 14:58:06 +0530 Subject: [PATCH] fix: fix ux for print preview page (#17087) Co-authored-by: Shariq Ansari --- frappe/printing/page/print/print.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/frappe/printing/page/print/print.js b/frappe/printing/page/print/print.js index cbb19a01a8..7db6930a60 100644 --- a/frappe/printing/page/print/print.js +++ b/frappe/printing/page/print/print.js @@ -19,7 +19,8 @@ frappe.pages['print'].on_page_load = function(wrapper) { }); }); } else { - print_view.frm = frappe.route_options.frm; + print_view.frm = frappe.route_options.frm.doctype ? + frappe.route_options.frm : frappe.route_options.frm.frm; frappe.route_options.frm = null; print_view.show(print_view.frm); } @@ -85,6 +86,10 @@ frappe.ui.form.PrintView = class { () => this.refresh_print_format(), { icon: 'refresh' } ); + + this.page.add_action_icon("file", () => { + this.go_to_form_view(); + }, '', __("Form")); } setup_sidebar() { @@ -498,6 +503,13 @@ frappe.ui.form.PrintView = class { } } + go_to_form_view() { + frappe.route_options = { + frm: this, + }; + frappe.set_route('Form', this.frm.doctype, this.frm.docname); + } + show_footer() { // footer is hidden by default as reqd by pdf generation // simple hack to show it in print preview