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.

0

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

By
Fongoh Tayong
on 2/5/16, 5:50 AM 423 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

else:

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
http://192.168.1.122:8069/web/static/lib/qweb/qweb2.js:48
Traceback:
Error: QWeb2 - template['ShowPaymentInfo']: No enumerator given to foreach
    at Object.QWeb2.tools.exception (http://192.168.1.122:8069/web/static/lib/qweb/qweb2.js:48:19)
    at Object.QWeb2.tools.foreach (http://192.168.1.122:8069/web/static/lib/qweb/qweb2.js:195:22)
    at Engine.eval (eval at <anonymous> (http://192.168.1.122:8069/web/static/lib/qweb/qweb2.js:404:33), <anonymous>:20:23)
    at Engine.QWeb2.Engine.QWeb2.tools.extend._render (http://192.168.1.122:8069/web/static/lib/qweb/qweb2.js:393:58)
    at Engine.QWeb2.Engine.QWeb2.tools.extend.render (http://192.168.1.122:8069/web/static/lib/qweb/qweb2.js:385:26)
    at OdooClass.form_common.AbstractField.extend.render_value (http://192.168.1.122:8069/account/static/src/js/account_payment_widget.js:24:32)
    at OdooClass.<anonymous> (http://192.168.1.122:8069/web/static/src/js/views/form_common.js:704:22)
    at OdooClass.Class.extend.trigger (http://192.168.1.122:8069/web/static/src/js/framework/mixins.js:222:31)
    at OdooClass._.extend.trigger (http://192.168.1.122:8069/web/static/src/js/framework/mixins.js:272:42)
    at http://192.168.1.122:8069/web/static/src/js/framework/mixins.js:338:22


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

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

1 follower(s)

Stats

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