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

Hello all,

In the new API, the search() method returns a recordset. For example, this code :

ids = self.search([('default_code', operator, name)])

COuld return something like this :

ids = product.product(1366, 1365, 1325, 1303, 1297, 1296, 1295, 1291)


How could I obtains a list of IDs like this instead????

ids = [1366, 1365, 1325, 1303, 1297, 1296, 1295, 1291]


Thanks


Аватар
Відмінити
Автор Найкраща відповідь

I have found how to get an ids list.

Just use :

ids.ids

to get :

[1366, 1365, 1325, 1303, 1297, 1296, 1295, 1291]

Аватар
Відмінити
Автор

Probably that products.ids would be a better name for my variable instead of ids.ids...

Найкраща відповідь

Hi Pascal,

You can also use like,

ids = self.search([('default_code', operator, name)]).ids


Regards,

Anil.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
write() vs update() Вирішено
4
вер. 20
41881
New Odoo api Вирішено
1
бер. 15
3621
1
лют. 16
4004
0
жовт. 22
3230
0
бер. 15
5302