Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
8893 Zobrazení


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 ?

Avatar
Zrušit
Nejlepší odpověď

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
Avatar
Zrušit
Autor

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 Odpovědi Zobrazení Aktivita
1
pro 23
20844
0
lis 16
2808
2
pro 23
19968
2
bře 15
8253
2
říj 15
8992