跳至內容
選單
此問題已被標幟
3 回覆
18265 瀏覽次數

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
41861
New Odoo api 已解決
1
3月 15
3594
1
2月 16
3983
0
10月 22
3220
0
3月 15
5297