This question has been flagged
2 Replies
1999 Views

Hi,

My code is as follows:

[odoorpc make connection and retrieve lots of other info]

productModel = odoo.env['product.product']
​product_id = productModel.search([('display_name', '=', 'example product')])

Strangely this returns a list with the ids to all products and not only "example product".

I can retrieve all the fields for all the products defined.

What am I missing here?

Kind regards,

Jeroen Baten


Avatar
Discard

I do not have enough karma to upvote the answer from Kanakinfosystems, but that solution is correct. Thanks!

Best Answer

Hi Jeroen,

Please replace 'display_name' with 'name' only and then give a try.

productModel = odoo.env['product.product']
​product_id = productModel.search([('name', '=', 'example product')])

Thanks.

Avatar
Discard