Odoo Help


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.


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

figol New
on 12/25/13, 11:56 PM 2,859 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');

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)


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