Skip to Content
Menú
This question has been flagged
3 Respostes
18284 Vistes

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


Avatar
Descartar
Autor Best Answer

I have found how to get an ids list.

Just use :

ids.ids

to get :

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

Avatar
Descartar
Autor

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

Best Answer

Hi Pascal,

You can also use like,

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


Regards,

Anil.

Avatar
Descartar
Related Posts Respostes Vistes Activitat
4
de set. 20
41867
1
de març 15
3600
1
de febr. 16
3987
0
d’oct. 22
3225
0
de març 15
5297