python - How to check if relation item is null -


how can check if related object null in openerp?

i have my_object has supplier_invoice field.

my_object declared as:

_columns = {         'supplier_invoice': fields.many2one('account.invoice',                                             'commission invoice',                                             ondelete='set null'), } 

and want this:

if my_object.supplier_invoice:      do_something() 

but doesn't work s returns browse_record if empty.

i using openerp 7

ok, had test :

if my_object.supplier_invoice.id:     do_this() 

the id false when record not exist


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -