Skip to Content
Menú
This question has been flagged
1 Respondre
5129 Vistes

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
Descartar
Best Answer

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
Descartar
Related Posts Respostes Vistes Activitat
0
de març 25
1114
2
de juny 20
6195
1
d’ag. 18
4408
2
de maig 16
3418
4
de març 16
14837