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


I have no problems using the search method with sudo but  the browse method gives no result.

search_objs =  env['res.partner'].sudo(user.id).search([])
browse_objs = env['res.partner'].sudo(user.id).browse([])
assert len(search_objs) = len(browse_objs)


Is this result difference intended ?

Is this only happening to my configuration ? .

Do you experience the same ?

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

Hi Yurdik

Using sudo with browse is not the problem, the issue is that browse receive always a an id or a list of ids to browse. As opposite to search that receive a domain that could be empty the browse method really need the ids to retrieve the results. If you pass a list of ids to the browse you could make the asserts works, like:

search_objs =  env['res.partner'].sudo(user.id).search([])
browse_objs = env['res.partner'].sudo(user.id).browse(search_objs)
assert len(search_objs) = len(browse_objs)# ok
อวตาร
ละทิ้ง
ผู้เขียน

I did forget that. :-) I do work a lot with erppeek, and erppeek allows to specify the search_domain also in browse. Thanks a lot.

Related Posts ตอบกลับ มุมมอง กิจกรรม
What is 'better': search or browse? แก้ไขแล้ว
1
ธ.ค. 23
20874
0
พ.ย. 16
2816
Using search count แก้ไขแล้ว
2
ธ.ค. 23
19989
2
มี.ค. 15
8280
2
ต.ค. 15
9032