Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
18262 Представления

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 Ответы Просмотры Активность
4
сент. 20
41861
New Odoo api Решено
1
мар. 15
3594
1
февр. 16
3982
0
окт. 22
3219
0
мар. 15
5297