Merge pull request #37745 from kaulith/fix/print-format-builder-beta-header

fix: pass letterhead and render layout header/footer in print format
This commit is contained in:
Ejaaz Khan 2026-03-04 22:28:58 +05:30 committed by GitHub
commit a5d591230b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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: