Skip to Content
Menu
This question has been flagged
2 Replies
2133 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
Related Posts Replies Views Activity
2
May 24
1052
1
Apr 24
1473
1
Dec 23
2743
0
Feb 23
1273
2
Nov 22
2422