Odoo Help

Welcome!

This community 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.

1

How to make looping in Qweb?

By
Mohammed Khamis
on 2/9/15, 5:24 AM 568 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
0

Yenthe

--Yenthe--
6696
| 7 7 8
Turnhout, Belgium
--Yenthe--

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

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

Yenthe
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:

<table>

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

<td>

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

</td>

<td>

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

</td>

</tr>

</table>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/9/15, 5:24 AM
Seen: 568 times
Last updated: 3/16/15, 8:10 AM