Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
7169 Widoki

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

Awatar
Odrzuć

Can you post che _columns content, please?

Najlepsza odpowiedź

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
Awatar
Odrzuć
Autor Najlepsza odpowiedź

Thanks... Works Fine!

Awatar
Odrzuć