Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
7073 Vistas

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

Avatar
Descartar

Can you post che _columns content, please?

Mejor respuesta

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
Avatar
Descartar
Autor Mejor respuesta

Thanks... Works Fine!

Avatar
Descartar