Odoo Help


How to make looping in Qweb?

Mohammed Khamis
on 2/9/15, 5:24 AM 964 views

please I would like an example for looping in qweb 

I want to loop on purchase_order but i don't know how can i make it 

please help me for that

thank you so much

Yenthe has a good example, you should however know that if you wish to update a variable from inside your loop you need to apply a recent patch: https://github.com/odoo/odoo/issues/4461

Stephen Mack
on 2/9/15, 6:19 PM


| 8 8 8

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

On 2/9/15, 5:28 AM

Hi Mohammed

There is a sample inside the purchase report, you should do pretty much the same.Have a look at https://github.com/odoo/odoo/blob/8.0/addons/purchase/views/report_purchaseorder.xml

You can loop over data like this:


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


<span t-field="line.name"/>



<span t-esc="', '.join(map(lambda x: x.name, line.taxes_id))"/>




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: 2/9/15, 5:24 AM
Seen: 964 times
Last updated: 3/16/15, 8:10 AM