Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
5113 Visualizzazioni

How can I get invoice type ("in_invoice" or "out_invoice")? I try this but I have an error. (AttributeError: 'browse_record_list' object has no attribute 'type')

invoice = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
if invoice.type =='in_invoice':
    return True
else:
    return False
Avatar
Abbandona
Risposta migliore

Hello, .browse() returns list so you need to loop trough your result or in this case you can use

if invoice[0].type  == "in_invoice" 

Hope this helps.

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
mar 25
1114
2
giu 20
6192
1
ago 18
4408
2
mag 16
3418
4
mar 16
14836