Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
5102 Представления

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