Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2926 Lượt xem

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


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 23
2008
2
thg 12 23
1445
Website Search bar Đã xử lý
3
thg 4 25
7842
1
thg 1 25
1024
3
thg 11 19
3171