Odoo Help


Get the partner_id of a user for window action domains

Tobias Wetzel
on 7/13/15, 11:25 AM 1,990 views

Hi I want to get the partner_id of a user for doing something like:

<act_window id="action_my_module_received_reviews" name="Received Reviews" res_model="my_module.review" domain="[('reviewer_id', '=', uid.partner_id)]"/> 

How can I do that?

EDIT: Solution - for simplicity I just reference the user id in my model directly instead of the partner_id


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 7/13/15, 1:17 PM

Sorry but you can't. Actually to do this you need to override the search on the model. Can be something like this:

def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
#this could have a check for this add domain based on a context value
partner_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id
return super(my_module_review, self).search(cr, uid, args, offset, limit, order, context, count)

You are correct. But could you provide a more detailed answer?

Limitless Virtual Enterprise, Andre de Kock
on 7/14/15, 3:07 AM

I edit my answer for an example of how to do it

Axel Mendoza
on 7/14/15, 3:24 AM

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

2 follower(s)


Asked: 7/13/15, 11:25 AM
Seen: 1990 times
Last updated: 4/1/18, 5:06 PM