Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2956 มุมมอง

hi guys 

im newbie in odoo developing , im using odoo 15 , and the ORM method not work properly 

i wanna getting product ids with search method in this way :

ids = self.env['product.product'].search([])
print('products ... ', ids)


the out put is expected like this:

products ... [1,2,3,...]

but it gives this in output instead :


products.... products.products(1,)


i don't know why this is happening , how can i solve this problem??? thank you in advanced


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

product_ids = self.env['product.product'].search([])

Above code will return record sets.

If you need to get ids add .ids along with it: 

ids = self.env['product.product'].search([]).ids

Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ส.ค. 23
2022
2
ธ.ค. 23
1452
Website Search bar แก้ไขแล้ว
3
เม.ย. 25
7852
1
ม.ค. 25
1038
3
พ.ย. 19
3181