Odoo Help

0

expecting number but found array

By
Francisco Martínez
on 6/14/13, 2:12 PM 3,228 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--
3654
| 6 8 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!

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

Question tools

0 follower(s)

Stats

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