Try ERPNext Buy Support Partners Foundation

Jinja and print formatting

I know I can get the customer’s address on the invoice by:


But this outputs code like:

<div>Stree Address<br>City<br>

I wish to get each part of the address separate and have more control over the styling, thus loose the <br> elements.

How do I go about obtaining each particular part of the billing address for the company?

I can retrieve all the fields on the invoice itself, but cant seem to get anything to pull back from linked tables.

try this in jinja templating
{{frappe.db.get_value(“Address”, {“name”:doc.customer_address}, “address_line1”) }}
{{frappe.db.get_value(“Address”, {“name”:doc.customer_address}, “address_line2”) }}

1 Like

Everything I’ve done so far has been through print-format-builder via the site for customizing invoices. Adding a Custom HTML block and adding my code. When I paste the above and preview, I get {{body}} when the PDF is shown.

Is there a way to add custom print formats in my app so I have access to the full html/jinja files? I’ve looked at the templates in the frappe app but not sure how to proceed with creating the print formats in my app and having them be available in the system.

I had a syntax error … so that worked… thank you!

For the second question, is there a way to move all this to my app, so that my custom print formats get installed with my app?

Yes you can select you app module like module name = your_app name then add this code into
fixtures = [{“dt”: “Print Format”, “filters”: [[“name”, “in”, [“your_print_format_name”]]]}] then
try bench export-fixtures

1 Like

A small side note on deploying print formats using apps: currently, this will make the app uninstallable without removing the formats manually, see

1 Like

In my case, the issue comes because the duplication in the naming series of Access Log DocType,
So I had solved it by edit the naming series of Access Log from the database (the table name is tabSeries) then edit the current value of the empty name with the latest number of Access Log. ___