Skip to Content
Menu
This question has been flagged
3 Replies
16299 Views

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
Discard
Author 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
Discard
Author

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
Discard
Related Posts Replies Views Activity
4
Sep 20
37556
1
Mar 15
2946
1
Feb 16
2978
0
Oct 22
2332
0
Mar 15
4506