I need to pass a value from js to qweb template, this error raised.
Thanks in advance
JS
onclick_contacts:function(event) {
var self = this;
ajax.jsonRpc("/messages/all_messages","call",{
}
).then(function(all_messages){
self.all_messages = all_messages;
var contacts = self.all_messages;
var options = contacts;
self.options = options;
self.$('.show_contact').html(QWeb.render('mail.systray.MessageMenu',{
values:options, widget:self
}));
})
},
QWEB
<div class="o_mail_systray_dropdown_items">
<div class="show_contact">
<t t-foreach="widget.options" t-as="option">
<t t-esc="option"/>
</t>
</div>
</div>
ERROR
Uncaught Error: QWeb2 - template['mail.systray.MessageMenu']: No enumerator given to foreach
http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3374
Traceback:
Error: QWeb2 - template['mail.systray.MessageMenu']: No enumerator given to foreach
at Object.exception (http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3374:7)
at Object.foreach (http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3388:80)
at Engine.eval (eval at _render (http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3416:73), <anonymous>:27:23)
at Engine._render (http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3415:296)
at Engine.render (http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3415:151)
at Engine._render (http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3419:57)
at Engine.render (http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3415:151)
at Class.renderElement (http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3674:1014)
at http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:3684:6
at http://192.168.2.25:8089/web/content/401-7f32d5f/web.assets_common.js:802:681