Search code examples
xmlodooqwebodoo-11odoo-view

How to pass records to the other page on custom qweb report for account.invoice ( Odoo V11 )?


I have a custom report template with header and footer

I extended this header and this footer from "web.external_layout_standard"

How can I specify the number of record on the report page.

For example, I want products to switch to the other page after 16th. I have problems like the picture.

Picture link: https://i.hizliresim.com/8YZDMk.png

I am trying this codes but not working correctly:

<t t-if="counter==16 and line['price_subtotal']">
      <tr class="text-right" style="border:0;border-top:0">
         <td colspan="6">
           <strong>Ara Toplam:</strong>
             <span>
               <t t-esc="subtotal" t-options="{'widget':'monetary', 
                                 'display_currency':o.currency_id}"/>
             </span>
         </td>
      </tr>
      <t t-set="counter" t-value="0" />
      <div style="page-break-after:auto;"></div>
</t> 

Solution

  • <t t-set="count" t-value="0"/>
    <t t-set="page" t-value="16"/>
    <t t-foreach="your_loop_variable" t-as="c">
        <t t-if="counter==16 and line['price_subtotal']">
          <tr class="text-right" style="border:0;border-top:0">
             <td colspan="6">
               <strong>Ara Toplam:</strong>
                 <span>
                   <t t-esc="subtotal" t-options="{'widget':'monetary', 
                                     'display_currency':o.currency_id}"/>
                 </span>
             </td>
          </tr>
          <t t-set="counter" t-value="0" />
          <t t-set="count" t-value="count+1" />
          <t t-if="count==page">
            <p style="page-break-after:auto;"></p>
            <t t-set="page" t-value="page+16" />
          </t>
        </t> 
    </t>
    
    • Please try this code :