コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
18254 ビュー

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
41860
New Odoo api 解決済
1
3月 15
3593
1
2月 16
3978
0
10月 22
3217
0
3月 15
5297