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

expecting number but found array

By
Francisco Martínez
on 6/14/13, 2:12 PM 2,898 views

When i access to the form with no rows in the oneToMany field, openErp return:

Uncaught Error: [_.sprintf] expecting number but found array

This error caused by this function:

def _total_presupuestos(self, cr, uid, ids, field_name, field_value, arg, context=None):
    result={} 
    total=0
    invoice_obj = self.pool.get('sat.incidencias')
    for records_invoice in invoice_obj.browse(cr, uid, ids, context=context):
        for records_invoice_lines in records_invoice.presupuesto_id:
            total += records_invoice_lines.pv_sin_impuestos
            result[records_invoice.id] = total
    return result

Help, please

Can you post che _columns content, please?

Francesco OpenCode
on 6/14/13, 2:46 PM
2

Francesco OpenCode

--Francesco OpenCode--
3608
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 6/14/13, 2:46 PM

Try this:

def _total_presupuestos(self, cr, uid, ids, field_name, field_value, arg, context=None):
    result={} 
    if not ids:
        return result
    total=0.0
    invoices = self.pool.get('sat.incidencias').browse(cr, uid, ids, context=context)
    for records_invoice in invoices:
        for records_invoice_lines in records_invoice.presupuesto_id:
            total += records_invoice_lines.pv_sin_impuestos
            result[records_invoice.id] = total
    return result
0
Francisco Martínez
On 6/24/13, 1:49 PM

Thanks... Works Fine!

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)

Stats

Asked: 6/14/13, 2:12 PM
Seen: 2898 times
Last updated: 3/16/15, 8:10 AM