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


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 ?

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

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
Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 23
20677
0
thg 11 16
2699
Using search count Đã xử lý
2
thg 12 23
19827
2
thg 3 15
8134
2
thg 10 15
8871