Se rendre au contenu
Menu
Cette question a été signalée
3 Réponses
18257 Vues

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
Ignorer
Auteur Meilleure réponse

I have found how to get an ids list.

Just use :

ids.ids

to get :

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

Avatar
Ignorer
Auteur

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

Meilleure réponse

Hi Pascal,

You can also use like,

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


Regards,

Anil.

Avatar
Ignorer
Publications associées Réponses Vues Activité
4
sept. 20
41860
1
mars 15
3593
1
févr. 16
3982
0
oct. 22
3218
0
mars 15
5297