Odoo Help


Web Module qweb.render error: "No enumerator given to foreach"

figol New
on 12/25/13, 11:56 PM 4,747 views

JS Code :

var context = {
    "title": "Random Title",
    "items": [
        { "name": "foo", "tags": {"bar": "baz", "qux": "quux"} },
        { "name": "Lorem", "tags": { "ipsum": "dolor" }
self.$el.html(QWeb.render( self.template,  context ));


  <div t-name="example_template" t-attf-class="base #{cls}">
    <h4 t-if="title"><t t-esc="title"/></h4>
      <li t-foreach="items" t-as="item">
           <t t-esc="item.name" />

Error Message:

 "No enumerator given to foreach"

It works fine without 't-foreach'. Thanks.

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

on 4/2/14, 2:15 PM
On 4/9/14, 6:19 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.votes = ["test", "test"]; //this.get('value');

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

0 follower(s)


Asked: 12/25/13, 11:56 PM
Seen: 4747 times
Last updated: 3/16/15, 8:10 AM