fix: re-introduce html param for attach_print

Fix error introced by d64836c1c4
This commit is contained in:
barredterra 2022-12-19 14:26:15 +01:00
parent ee9bfed4ec
commit ab95cffae9

View file

@ -2010,12 +2010,14 @@ def attach_print(
file_name=None,
print_format=None,
style=None,
html=None,
doc=None,
lang=None,
print_letterhead=True,
password=None,
):
from frappe.utils import scrub_urls
from frappe.utils.pdf import get_pdf
if not file_name:
file_name = name
@ -2044,10 +2046,14 @@ def attach_print(
if int(print_settings.send_print_as_pdf or 0):
ext = ".pdf"
kwargs["as_pdf"] = True
content = get_print(doctype, name, **kwargs)
content = (
get_pdf(html, options={"password": password} if password else None)
if html
else get_print(doctype, name, **kwargs)
)
else:
ext = ".html"
content = scrub_urls(get_print(doctype, name, **kwargs)).encode("utf-8")
content = html or scrub_urls(get_print(doctype, name, **kwargs)).encode("utf-8")
out = {"fname": file_name + ext, "fcontent": content}