odooqweb

Odoo invoice page break after 30 lines


I created a custom invoice but now I am having trouble breaking the page when product lines are more than 30. I am trying to do this so it doesn't overlap with the total amount and payment terms (see image for the desired scenario)

Update code snippet: https://pastebin.com/WDr5uphK

I tried adding <div style="page-break-after: always;"/> using foreach but it breaks the whole table and moves to next page.


Solution

  • You can close the table, add the page break and open a new table

    Example:

    <t t-if="page_break == row_index">
      &lt;/tbody&gt;
      &lt;/table&gt;
    
      <div style="dislay: block;page-break-after: always;"/>
    
      &lt;table class="table"&gt;
      &lt;tbody&gt;
    </t>