Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5118 Lượt xem

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
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 25
1114
2
thg 6 20
6192
1
thg 8 18
4408
2
thg 5 16
3418
4
thg 3 16
14836