Odoo Help


Error: QWeb2 - template['ShowPaymentInfo']: No enumerator given to foreach

Fongoh Tayong
on 2/5/16, 5:50 AM 1,322 views

Please, i have this code  

def evaluate_transport(self):

print "computing transport information"

total_expense_no_affect_salary = 0

total_expense_affects_salary = 0

total_income = 0

for i in self:

for j in i.transport_invoice_ids:

total_income += j.inc_amount

if j.affects_salary:

total_expense_affects_salary += j.exp_amount


total_expense_no_affect_salary += j.exp_amount

i.total_expense = total_expense_no_affect_salary + total_expense_affects_salary

i.total_expense_no_affect_salary = total_expense_no_affect_salary

i.total_expense_affects_salary = total_expense_affects_salary

i.total_income = total_income

print str(i.total_income) + " \n"

print str(i.total_expense) + " \n"

print str(i.total_expense_no_affect_salary) + " \n"

print str(i.total_expense_affects_salary) + " \n"

print "Done with total income and total expense"

The function is by a button click. 
Trying to sum based on a boolean field and i get the error 

Uncaught Error: QWeb2 - template['ShowPaymentInfo']: No enumerator given to foreach
Error: QWeb2 - template['ShowPaymentInfo']: No enumerator given to foreach
    at Object.QWeb2.tools.exception (
    at Object.QWeb2.tools.foreach (
    at Engine.eval (eval at <anonymous> (, <anonymous>:20:23)
    at Engine.QWeb2.Engine.QWeb2.tools.extend._render (
    at Engine.QWeb2.Engine.QWeb2.tools.extend.render (
    at OdooClass.form_common.AbstractField.extend.render_value (
    at OdooClass.<anonymous> (
    at OdooClass.Class.extend.trigger (
    at OdooClass._.extend.trigger (

I have not used any javascript code. 

I have a transport.invoice and transport.invoice.line model, following same way account.invoice and account.invoice.line is implemented. 

    Want to sum all income and expense(determined by a checkbox) items on the transport.invoice.line 

Please, any help. 

Am still new to odoo so sorry if i have wrong convention. 

Using odoo 9

Fongoh Tayong
on 2/5/16, 5:50 AM

You need to put upload your code to github and provide us the link to determine what is causing your problem

Axel Mendoza
on 2/5/16, 2:06 PM

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

1 follower(s)


Asked: 2/5/16, 5:50 AM
Seen: 1322 times
Last updated: 2/5/16, 7:20 AM