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
- Comptabilité
- Inventaire
- PoS
- Projet
- MRP
Cette question a été signalée
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>
```
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrire| Publications associées | Réponses | Vues | Activité | |
|---|---|---|---|---|
|
|
2
oct. 25
|
3517 | ||
|
|
1
sept. 25
|
3389 | ||
|
|
3
juil. 25
|
4578 | ||
|
|
1
mai 25
|
2718 | ||
|
|
4
mai 25
|
4164 |
<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>