跳至内容
菜单
此问题已终结
3 回复
18294 查看

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


形象
丢弃
编写者 最佳答案

I have found how to get an ids list.

Just use :

ids.ids

to get :

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

形象
丢弃
编写者

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

最佳答案

Hi Pascal,

You can also use like,

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


Regards,

Anil.

形象
丢弃
相关帖文 回复 查看 活动
4
9月 20
41881
New Odoo api 已解决
1
3月 15
3617
1
2月 16
3996
0
10月 22
3230
0
3月 15
5299