Skip to Content
मेन्यू
This question has been flagged
3 Replies
18266 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
सित॰ 20
41861
1
मार्च 15
3595
1
फ़र॰ 16
3983
0
अक्तू॰ 22
3221
0
मार्च 15
5297