تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
18274 أدوات العرض

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.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
write() vs update() تم الحل
4
سبتمبر 20
41865
New Odoo api تم الحل
1
مارس 15
3597
1
فبراير 16
3985
0
أكتوبر 22
3222
0
مارس 15
5297