Warning: include_once(/home/favoledo/robertozanardo.com/wp-content/sunrise.php): Failed to open stream: No such file or directory in /home/favoledo/robertozanardo.com/wp-includes/ms-settings.php on line 52

Warning: include_once(): Failed opening '/home/favoledo/robertozanardo.com/wp-content/sunrise.php' for inclusion (include_path='.:/opt/alt/php83/usr/share/pear:/opt/alt/php83/usr/share/php:/usr/share/pear:/usr/share/php') in /home/favoledo/robertozanardo.com/wp-includes/ms-settings.php on line 52
odoo qweb page break table - Odoo e Soluzioni Open Source

odoo qweb page break table

Le interruzioni di pagina nei report qweb di Odoo possono essere un vero incubo!

Sui vari forum ci sono diverse soluzioni utilizzando le varie combinazioni di page-break-before, page-break-inside, page-break-after.

Però il funzionamento è veramente troppo discrezionale in base al tipo di contenuto, una delle esigenza più comuni è forzare il salto pagina dopo un certo numero di line, di articoli o di elementi, o renderlo condizionale in generale ad alcuni contenuti specifici della pagina.

Questo si può ottenre impostando delle variabili a livello del report con il tag t-set per esempio.

Ma nel caso di tabelle html (ovvero la maggior parte dei casi) spesso non si riesce ad avere una vera interruzione di pagina oppure si ottengono effetti indesiderati come il salto completo della prima pagina o similari.

Anche se strana, cercando a destra e a manca, ho trovato una combinazione di soluzioni che messa insieme opportunamente produce l’effetto desiderato, a scapito dell’eleganza!

Di fatto si tratta di impostare un contatore incrementale e, al verificarsi di una data condizione, forzare la chiusura e la riapertura della tabella:

<table style="width:100%;">
  <tbody>
    <t t-set="counter" t-value="0"/>
    <t t-foreach="o.loading_ids" t-as="line">
    <t t-set="counter" t-value="counter + 1"/>
      <t t-if="counter == 4">
            &lt;/tbody&gt;
            &lt;/table&gt;

            <div style="dislay: block;page-break-after: always;"/>

            &lt;table class="table"&gt;
            &lt;tbody&gt;
          <t t-set="counter" t-value="0"/>
      </t>
    <tr>
      <td><div class="headstyle">Luogo di carico</div></td>
      <td><div class="headstyle">Luogo di scarico</div></td>
    </tr>
    <tr>
      <td>
          <br/><br/><b><span t-field="line.Partenza"/></b><br/>
      </td>
      <td>
          <br/><br/><b><span t-field="line.Destinazione"/></b><br/>
      </td>
    </tr>
  </tbody>
</table>

Page breaks in Odoo’s qweb reports can be a real nightmare!

On the forums there are different solutions using various combinations of page-break-before, page-break-inside, page-break-after.

However, the operation is really too discretionary based on the type of content, one of the most common needs is to force the page jump after a certain number of lines, articles or elements, or make it conditional in general to some specific contents of the page.

This can be achieved by setting variables at the report level with the t-set tag for example.

But in the case of html tables (that is most of the cases) it is often not possible to have a real page break or you get unwanted effects such as the complete skipping of the first page or similar.

Although strange, looking left and right, I found a combination of solutions that when properly put together produces the desired effect, to the detriment of elegance!

In fact, it is a question of setting an incremental counter and, when a given condition occurs, forcing the closing and reopening of the table like in the example code before.

Lascia un commento

kolaybet
kolaybet giriş
kolaybet
betgaranti
Kolaybet
kolaybet
grandpashabet
grandpashabet
grandpashabet
bettilt
grandpashabet
Kolaybet
grandpashabet
kolaybet
sahabet
sahabet
betpark
betgaranti
betpark
betgaranti
kolaybet
kolaybet
betpark
betpark
betgaranti
betgaranti giriş
betgaranti güncel giriş
betgaranti
betgaranti 2026
hellocasino
betgaranti 2026
betgaranti
betgaranti 2026
Kolaybet 2026
Kolaybet
Kolaybet Mobil Giriş
Kolaybet Güncel Giriş
bettilt
vdcasino
vdcasino
betgaranti
betgaranti giriş
betgaranti 2026
kolaybet
kolaybet giriş
kolaybet 2026
betpark
betgaranti
betgaranti mobil giriş
betpark