0
votes

I've created my custom report and which has more than 1 page. You can imagine that each page has a table. And table can have 10 row in a page, if rows are more than 10, rows go second page. By the way, other table slides to half of page. But I want to all tables should start the top of the page in any case. If there is 14 row in the first table, the second table must start the third page. I wrote a condition in python like;

extrapage = fields.Boolean(compute="function") 
def function():
if row >=10:
    extrapage = True

and view.xml

<t
t-if="o.extrapage"
<div style="height:29cm;width:20cm;"></div>
</t>

but i dont want to make like this, must be some professional way. Can you help me to do? Thank you.

1
I think you need to know how to use page-break-after or inside or beforekhelili miliana
I tried but couldn't work it, maybe i made mistake. Can you tell me how to use it, if you know?Serdar Eren
Eran ,I will add an example, try it plskhelili miliana
Refer odoo base. You get your answerKeval Mehta

1 Answers

2
votes

Please follow and use the below code in the Qweb Template View

Let assume that o is your purchase order and I will try to break the page when my purchase order line having more than 10 records.

<tr t-foreach="o.order_line" t-as="line">

    <t t-if="line_index+1 == 10">
        <p style="page-break-after:always;"/>
    </t>
</tr>

Attributes :

=> o : purchase order object

=> order_line : is the purchase order line

=> _index : its special attribute in the qweb template which is help to count the interaction record inside line object.

I hope my answer may helpful for you :)