Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Please, i have this code
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
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
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 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.
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 2/5/16, 5:50 AM|
|Seen: 1042 times|
|Last updated: 2/5/16, 7:20 AM|