I want to get only 10 lines of table records on every page of odoo qweb report.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hi, you can try this
<t t-set="i"t-value="1" />
<tr t-foreach="o.order_line"t-as="l">
<t t-if="i % 10 == 0">
<p style="page-break-after:always;" />
t>
<td>
<span t-esc="i" />
td>
<t t-set="i" t-value="i+1" />
tr>
Sorry for the typos but code blocks don't works properly, watch out for open tags.
It is not working. It moves the whole table onto the next page
You can try splitting the recordset into chunks and create multiple tables on different pages.
```
<template id="report_template_test">
<t t-call="web.html_container">
<t t-call="web.internal_layout" t-lang="it_IT">
<div class="page">
<t t-set="chunk_size" t-value="10" />
<t t-set="chunks" t-value="[docs.ids[i:i+chunk_size] for i in range(0, len(docs), chunk_size)]" />
<t t-foreach="chunks" t-as="c">
<t t-call="report_table_test_template">
<t t-set="records" t-value="c" />
</t>
<p style="page-break-after:always;" />
</t>
</div>
</t>
</t>
</template>
<template id="report_table_test_template">
<!-- Create your table -->
<table class="table">
<thead>
<tr>
<th>#</th>
</tr>
</thead>
<tbody>
<t t-foreach="records" t-as="rec">
<tr>
<td>
<span t-esc="i" />
</td>
</tr>
</t>
</tbody>
</table>
</template>
```
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
2
Dec 24
|
3112 | ||
|
1
Dec 24
|
343 | ||
|
4
Nov 24
|
1362 | ||
|
1
Sep 24
|
1132 | ||
|
1
Sep 24
|
1198 |
<table class="sth">
<thead>
<tr>
<th class="table_head" ><b>a</b></th>
<th class="table_head" ><b>b</b></th>
</tr>
</thead>
<tbody>
<t t-set="i" t-value="1" />
<tr t-foreach="o.ids" t-as="invoice_line">
<td class = "table_border">
<span t-esc="i"></span>
<t t-set="i" t-value="i+1" />
</td>
<td class = "table_border">
<span t-field="invoice_line.name" />
</td>
</tr>
</tbody>
</table>
I have tried this but it is not working.
<t t-set="i" t-value="1"/>
<tr t-foreach="o.order_line" t-as="l">
<!--Check Condition and break-->
<td> <span t-esc="i"/></td>
<t t-set="i" t-value="i+1"/>
</tr>