Skip to Content
Menu
This question has been flagged
3 Replies
18269 Rodiniai

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


Portretas
Atmesti
Autorius 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]

Portretas
Atmesti
Autorius

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.

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
4
rugs. 20
41865
1
kov. 15
3595
1
vas. 16
3985
0
spal. 22
3222
0
kov. 15
5297