Odoo Help


Should sudo work with browse ?

Yurdik Cervantes Mendoza
on 4/6/16, 2:20 PM 1,319 views

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 ?


Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 4/6/16, 2:29 PM

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.

Yurdik Cervantes Mendoza
on 4/6/16, 4:57 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/6/16, 2:20 PM
Seen: 1319 times
Last updated: 8/29/17, 2:08 PM