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
- Contabilità
- Magazzino
- PoS
- Progetti
- MRP
La domanda è stata contrassegnata
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>
```
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati| Post correlati | Risposte | Visualizzazioni | Attività | |
|---|---|---|---|---|
|
|
2
ott 25
|
3519 | ||
|
|
1
set 25
|
3389 | ||
|
|
3
lug 25
|
4579 | ||
|
|
1
mag 25
|
2719 | ||
|
|
4
mag 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>