Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Sonny V is correct. You can achieve this by checking a condition. Set foo == True when you want to break the loop, ie when i == 3. It does loop through the rest of the items however, so isn't an elegant solution.
<t t-set="foo" t-value="False"/>
<t t-foreach="[1, 2, 3, 4, 5, 6]" t-as="i">
<t t-if="foo == False">
<t t-set="foo" t-value="True"/>
If it doesn't have to be a purely qweb solution, you can write a python function to break at the correct place / filter the items. so the qweb only has to output them.
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">
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 3/9/15, 6:31 AM|
|Seen: 3053 times|
|Last updated: 10/24/17, 6:46 AM|