Odoo Help

Welcome!

This community 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.

0

Should sudo work with browse ?

By
Yurdik Cervantes Mendoza
on 4/6/16, 2:20 PM 424 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 ?

1

Axel Mendoza

--Axel Mendoza--
10238
| 7 7 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 an 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/6/16, 2:20 PM
Seen: 424 times
Last updated: 4/6/16, 4:55 PM