Odoo Help


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.


Get the partner_id of a user for window action domains

Tobias Wetzel
on 7/13/15, 11:25 AM 659 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--
| 6 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 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

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

2 follower(s)


Asked: 7/13/15, 11:25 AM
Seen: 659 times
Last updated: 7/17/15, 12:38 PM