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

qweb can't use t-foreach

By
codefans
on 6/17/13, 8:08 AM 3,623 views

how to use t-foreach in qweb, i add the https://doc.openerp.com/trunk/web/qweb/ example

it show ' No enumerator given to foreach' where is wrong .?

I got the same error. Had you make it down ?

figol New
on 12/25/13, 11:45 PM

yes, i think you can use exit addon app to change instead of create new

codefans
on 1/6/14, 10:36 PM
0

Yannick Vaucher

--Yannick Vaucher--
1699
| 5 7 9
Lausanne, Switzerland
--Yannick Vaucher--
Yannick Vaucher
On 8/19/13, 4:03 PM

You may have forgotten to add the field on which you want to iterate before your template in your kanban.

I had the same problem but now i've solve it. I share my code hoping that it will be helpfull (sorry for my poor english) : <ol> <li t-foreach="widget.categories" t-as="category"> <img class="oe_hr_responsive_category" t-att-src="widget.get_image_url(category)" /> </li> </ol>

tamo harold
on 2/24/14, 8:03 AM

I have the same error. Since there is many people asking this question I suspect a bug, here is the bug report : https://bugs.launchpad.net/openobject-addons/+bug/1301474

YannickB
on 4/2/14, 2:16 PM
0
YannickB
On 4/9/14, 6:20 AM

Please look at my bug ticket on Launchpad : https:// bugs.launchpad.net/openobject-addons/+bug/1301474?comments=all (It was finally not a bug).

You need to initialize the variable in _init, otherwise the foreach will not find it. Exemple :

init: function (field_manager, node) {
    this._super(field_manager, node);
    this.votes = [];
},

start: function() {
    this._super();
    this.votes = ["test", "test"]; //this.get('value');
},

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

0 follower(s)

Stats

Asked: 6/17/13, 8:08 AM
Seen: 3623 times
Last updated: 3/16/15, 8:10 AM