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

hello 

what is the use of browse method in odoo 15 ?



thank you in advance


อวตาร
ละทิ้ง

Browse method is used to get record set from database id or list of ids. In orders now you have record set of order [2,5,7] and you need to execute for loop to print data.

คำตอบที่ดีที่สุด

Hi,

When you have an id or list of ids of an object and you have to get its record sets, you can use the browse orm method.

Suppose if you have list of id's of res.partner, lets says, partner_ids = [1,2,3] and if you need to get records, you can use browse method as follow:

partner_ids = [1,2,3]
partners = self.env['res.partner'].browse(partner_ids)

Result: res.partner(1,2,3)


See this video illustrating the same:https://www.youtube.com/watch?v=qgcGpdGCxeA

Thanks & Regards

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

You can use browse to get a list of records of the current module or if you specify the module then you can get records of the specified module

eg

self.browse(ids) // current table

self.env['res.company'].browse(company_id) // res_company table
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 22
2264
1
มิ.ย. 25
1867
3
ก.ค. 25
3478
1
พ.ค. 25
1605
1
พ.ค. 25
1848