Reputation: 21
I am trying to get the taxes_id
from a product template which is a many2many attribute field.
I think I somehow need to read an array?
Can anyone point me in the right direction how to read the id?
My tests are:
bla = self.pool.get('product.template').browse(cr, uid, id, context)
bla.taxes_id
But it's not working...
Upvotes: 0
Views: 1181
Reputation: 14746
Try following,
taxes = self.pool.get('product.template').browse(cr, uid, id, context)
if taxes and taxes.taxes_id:
for tax in taxes.taxes_id:
print tax.name
### tax.id
taxes_id is not required field in product.template it may not have values, you should provide checking for value existance.
Upvotes: 1