Sales invoice with terms & conditions on back page

Is there a way to customize the sales invoice so as to always print terms & conditions on the back page?

Try adding <div class="page-break"></div> before terms and condition.

Thank you for your answer. I tried your suggestion by adding a separate custom HTML entity with your code in it. It didn’t work. Then I tried adding your code on top of the “terms and conditions” HTML entity. It didn’t work either. It doesn’t seem to cause a new page break, only a dashed line across the page and only in print preview. In printout and in PDF out it has no effect whatsoever.

I’m on ERPnext V8.

After searching the forum and the documentation, googling around for similar discussions and experimenting, I found a solution:

Your code (<div class="page-break"></div>) works ONLY if used in a custom print format.
E > Setup > Print Format > New > Standard = no, Custom Format = Checked

Apparently, the page processor for printouts generated through Print Format Builder strips out or overrides any page break references including CSS
page-break-after: always; page-break-before: always; page-break-inside: always;

This could be a new feature for future versions: Like the “Custom HTML” element, have a dedicated element for page break that works in Print Format Builder.

A humble suggestion: Your team could invest some considerable time refreshing, updating and enriching the documentation. It will save time both for your clients (less searching around and asking in the forums) and your team (answering the forums). Many of the screenshots and the videos refer to a previous version. Customization commands, scripts and rich examples are scarce. A list of all ERPnext’s & frappe’s custom commands & variables available in Jinja along with usage examples would be a life saver.

I personally consider extensive & detailed documentation more important than getting a new software version or some features. It’s a game-changer in most cases and a major factor when selecting software.

Thank you for your time.

Hey @D_Petropoulos

I am also just user like you, trying to find solution to many issues on the forum. But this is an open source solution, only we can make it better by helping each other. Documentation is mostly a challenge in any opensource project.

For Jinja below link helped me:
http://jinja.pocoo.org/docs/2.9/templates/#list-of-builtin-filters

For Frappe commands below can link can be useful
http://frappe.github.io/frappe/user/en/

I am deeply sorry for the misunderstanding. I thought that the ERPnext/frappe development team responded to questions and issues on this discussion forum.

Thank you for clarifying the situation and for helping me.

1 Like

hi @D_Petropoulos

did you solve this? I’m trying to use the <div class="page-break"></div>
but it doesn’t work.

Could you post the complete solution?
So far I have for Quotation:

E > Setup > Print Format > New
DotType: Quotation
Module: Selling
Disabled = Unchecked
Standard = no
Custom Format = Checked

Missing parts:
Print Format Type = ???
HTML = ???
Custom CSS = ???

Yes, I did. The complete information follows:

E > Setup > Print Format > New
DocType = “Sales Invoice” in my case
Standard = “No”
Module = “Accounts” in my case
Custom Format = Checked
Disabled = Unchecked
Print Format Type = “Server”
HTML:
enter here front page html code
blank line
<div class="page-break"></div>
<br>
enter here back page html code

Custom CSS:
none needed, you may put your own code

I hope this helps. Note that the preview is tricky and doesn’t reflect the true printout in all cases. I suggest you use a print-to-PDF functionality to save paper and toner.

Thanks. It seems I’m nearly there. I was able to print T&C on the next page using what you’ve described above. My code is:

<div class="page-break"></div>
<br>
<div class="row section-break">
	<div class="col-xs-12 column-break">
        	<div style="padding: 10px 0px" data-fieldname="terms" data-fieldtype="Text Editor">
			{{ doc.terms }}
		</div>
	</div>
</div>

However, my T&C are rather long and have multiple pages. To create T&C I used E > Setup > Terms and Conditions > New.
In T&C I used html editor </> to create my document. In here I also used

<div class="page-break"></div>
<br>

But… in the pdf printout I only get the first page-break from my custom Print Format. All page-breaks within Terms and Conditions document are ignored. I have a few tables in my T&C and now they appear across multiple pages, which doesn’t look good.

By any chance, have you solved this as well?

I didn’t have to extend the back page content to multiple pages so I’m afraid the answer to your question is no. I haven’t tried more than one page break. Sorry.

A possible solution would be to have the terms & conditions divided and laid out in such a way as to have the pages after the back page in a separate PDF file.

hei sorry for the (maybe) the dumb question, how do i get the front page HTML code?

i want to print Sales Order, with T&C always on the separate page…

Use Page break class in html and create a class in css for page break
HTML:

p class=pagebreak > </p

Use the correct syntax here as post wont allow me to use it here.

CSS :

.pagebreak { page-break-before: always; } /* page-break-after works, as well */

so in Print Format :

Standard : NO
Custom CSS : .pagebreak { page-break-before: always; } /* page-break-after works, as well */

Is that the exact CSS code?

Thanks so much!

Yes that’s the exact css
But don’t forget the correct syntax for p in html

what is the correct syntax? sorry i didn’t get that part :upside_down_face:

< p > class=pagebreak > < / p >

Remove the spaces in between and use the above as html