Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
18256 Vistas

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 Mejor respuesta

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...

Mejor respuesta

Hi Pascal,

You can also use like,

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


Regards,

Anil.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
4
sept 20
41860
1
mar 15
3593
1
feb 16
3982
0
oct 22
3218
0
mar 15
5297