Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
5107 Переглядів

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
Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
бер. 25
1114
2
черв. 20
6189
1
серп. 18
4405
2
трав. 16
3417
4
бер. 16
14835