跳至内容
菜单
此问题已终结
1 回复
2963 查看

hi guys 

im newbie in odoo developing , im using odoo 15 , and the ORM method not work properly 

i wanna getting product ids with search method in this way :

ids = self.env['product.product'].search([])
print('products ... ', ids)


the out put is expected like this:

products ... [1,2,3,...]

but it gives this in output instead :


products.... products.products(1,)


i don't know why this is happening , how can i solve this problem??? thank you in advanced


形象
丢弃
最佳答案

Hi,

product_ids = self.env['product.product'].search([])

Above code will return record sets.

If you need to get ids add .ids along with it: 

ids = self.env['product.product'].search([]).ids

Thanks

形象
丢弃
相关帖文 回复 查看 活动
2
8月 23
2027
2
12月 23
1458
3
4月 25
7865
1
1月 25
1044
3
11月 19
3184