Ricardo Silva
Ricardo Silva

Reputation: 21

Odoo 15 - Create a new page in Qweb report

i´m new to odoo and i want to understand if its possible to create a new page for my report

<template id="report_livro">
        <t t-call="web.html_container">
            
            <t t-foreach="docs" t-as="o">
                <center>
                    <h1>TERMO DE ABERTURA</h1>
                </center>
                <span t-field="o.my_id"/>
                <t t-foreach="o.visitas_ids" t-as="v">
                    <center>
                        <h1>VISITAS</h1>
                    </center>
                    <span t-field="v.my_id"/>
                </t>
            </t>
        </t>
</template>

This is my template and i want to have a new page after the <span t-field="o.my_id"/>

Thanks in advance for any answers :)

i tried to use a div class like this <div class="page-break"/>

Upvotes: 2

Views: 607

Answers (1)

Pierre Locus
Pierre Locus

Reputation: 321

To create a new page in any QWeb report, the best way is to place an element with one CSS rule where you want to go to the next page:

<template id="report_livro">
    <t t-call="web.html_container">
        
        <t t-foreach="docs" t-as="o">
            <center>
                <h1>TERMO DE ABERTURA</h1>
            </center>
            <span t-field="o.my_id"/>
            <p style="page-break-before: always"/> <!-- This is what you want -->
            <t t-foreach="o.visitas_ids" t-as="v">
                <center>
                    <h1>VISITAS</h1>
                </center>
                <span t-field="v.my_id"/>
            </t>
        </t>
    </t>
</template>

You can use page-break-before or page-break-after :)

Upvotes: 0

Related Questions