تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5121 أدوات العرض

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.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مارس 25
1114
2
يونيو 20
6194
1
أغسطس 18
4408
2
مايو 16
3418
4
مارس 16
14837