Odoo Help


How to break from for loop in qweb?

Mohammed Khamis
on 3/9/15, 6:31 AM 2,086 views

I want to break the looping but I dont have any information about this .

please help me how can do it.

thank you so much



| 5 3 8
Pondicherry, India
On 3/9/15, 8:59 AM

you can use this code in the place for you page break:

 <!-- Pagebreak -->
                        <t t-if="p_index &lt; p_size - 1">
                            <p style="page-break-before:always;"> </p>
                            <table class="table table-condensed">


voathnak lim
On 1/2/17, 2:31 AM

Hi I got the same issue,

how can i make the loop stop at item 3? is there any break; code?



     <t t-foreach="[1, 2, 3, 4, 5, 6]" t-as="i">

         <t t-if="condition"> <p><t t-esc="i"/></p>




On 3/9/15, 7:58 AM

You haven't really provided us with a lot of info but the following might work?

    <t t-foreach="[1, 2, 3]" t-as="i">
        <t t-if="condition">
            <p><t t-esc="i"/></p>

you loop through elements, check for a condition, if the condition is not met it'll break out of the if and if you don't have any statements under the if statement it'll break out of the for loop for that iteration

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/9/15, 6:31 AM
Seen: 2086 times
Last updated: 1/2/17, 2:31 AM