Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
5115 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
maalisk. 25
1114
2
kesäk. 20
6192
1
elok. 18
4408
2
toukok. 16
3418
4
maalisk. 16
14836