fix: pass letterhead and render layout header/footer in print format builder beta browser print

This commit is contained in:
Kaushal Shriwas 2026-03-04 02:02:01 +05:30
parent 159a56a59f
commit 84fb0d000c
2 changed files with 6 additions and 3 deletions

View file

@ -92,9 +92,9 @@ class PrintFormatGenerator:
def get_header_footer_html(self):
header_html = footer_html = None
if self.letterhead:
if self.letterhead or self.layout.get("header"):
header_html = frappe.render_template("templates/print_format/print_header.html", self.context)
if self.letterhead:
if self.letterhead or self.layout.get("footer"):
footer_html = frappe.render_template("templates/print_format/print_footer.html", self.context)
return header_html, footer_html

View file

@ -76,7 +76,10 @@ def get_context(context) -> PrintContext:
from frappe.utils.weasyprint import get_html
body = get_html(
doctype=frappe.form_dict.doctype, name=frappe.form_dict.name, print_format=print_format.name
doctype=frappe.form_dict.doctype,
name=frappe.form_dict.name,
print_format=print_format.name,
letterhead=letterhead,
)
body += trigger_print_script
else: