Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
2848 Переглядів

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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
серп. 23
1940
2
груд. 23
1391
Website Search bar Вирішено
3
квіт. 25
7744
1
січ. 25
958
3
лист. 19
3105