Odoo Help


Get the partner_id of a user for window action domains

Tobias Wetzel
on 7/13/15, 11:25 AM 1,329 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
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: 1329 times
Last updated: 7/17/15, 12:38 PM