From 0b1821b10a5a7053c8c9a807835e9d6d8fab50d5 Mon Sep 17 00:00:00 2001 From: Don-Leopardo Date: Wed, 22 Dec 2021 13:10:22 -0300 Subject: [PATCH 1/3] fix: Module path for external print formats --- frappe/www/printview.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frappe/www/printview.py b/frappe/www/printview.py index 569ebe27d6..e9be76373f 100644 --- a/frappe/www/printview.py +++ b/frappe/www/printview.py @@ -2,7 +2,7 @@ # License: MIT. See LICENSE import frappe, os, copy, json, re -from frappe import _ +from frappe import _, get_module_path from frappe.modules import get_doc_path from frappe.core.doctype.access_log.access_log import make_access_log @@ -251,8 +251,9 @@ def get_print_format(doctype, print_format): frappe.DoesNotExistError) # server, find template - path = os.path.join(get_doc_path(frappe.db.get_value("DocType", doctype, "module"), - "Print Format", print_format.name), frappe.scrub(print_format.name) + ".html") + module = print_format.module or frappe.db.get_value("DocType", doctype, "module") + path = os.path.join(get_module_path(module, "Print Format",print_format.name), + frappe.scrub(print_format.name) + ".html") if os.path.exists(path): with open(path, "r") as pffile: From c9ce941554fccfcafc7d07501c587993a1c0d7b5 Mon Sep 17 00:00:00 2001 From: Don-Leopardo Date: Wed, 22 Dec 2021 14:19:08 -0300 Subject: [PATCH 2/3] fix: Unused imports --- frappe/www/printview.py | 1 - 1 file changed, 1 deletion(-) diff --git a/frappe/www/printview.py b/frappe/www/printview.py index e9be76373f..088c9dc403 100644 --- a/frappe/www/printview.py +++ b/frappe/www/printview.py @@ -4,7 +4,6 @@ import frappe, os, copy, json, re from frappe import _, get_module_path -from frappe.modules import get_doc_path from frappe.core.doctype.access_log.access_log import make_access_log from frappe.utils import cint, sanitize_html, strip_html from frappe.utils.jinja_globals import is_rtl From abaa2dc35e8355af9a13d7887cf24dcb6f0f89c8 Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Tue, 18 Jan 2022 11:57:38 +0530 Subject: [PATCH 3/3] style: Fix formatting issue --- frappe/www/printview.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/www/printview.py b/frappe/www/printview.py index 088c9dc403..bea1300764 100644 --- a/frappe/www/printview.py +++ b/frappe/www/printview.py @@ -251,7 +251,7 @@ def get_print_format(doctype, print_format): # server, find template module = print_format.module or frappe.db.get_value("DocType", doctype, "module") - path = os.path.join(get_module_path(module, "Print Format",print_format.name), + path = os.path.join(get_module_path(module, "Print Format", print_format.name), frappe.scrub(print_format.name) + ".html") if os.path.exists(path):