Thomas Klosinsky
Thomas Klosinsky

Reputation: 21

Odoo 8 - get products many2many attribute id (taxes_id) in python

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

Answers (1)

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

Related Questions