Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odgovori
18275 Prikazi

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
Opusti
Avtor 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
Opusti
Avtor

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
Opusti
Related Posts Odgovori Prikazi Aktivnost
4
sep. 20
41865
1
mar. 15
3597
1
feb. 16
3985
0
okt. 22
3222
0
mar. 15
5297