Odoo Help


How to open custom form view when clicking a many2one field

on 6/30/15, 11:47 AM 2,857 views

Hello,  I am having trouble opening a custom form view that is restricted to a group if a user clicks a many2one field from a parent view.  For example, I have a Project Developer group that may see the partner_id field on a Project Issue form.  If the Developer clicks the partner_id field, then it should open a custom Partner form view with restricted information.  Right now it is opening the base partner form view, and shows too much information.  Does anyone know how to open a custom partner form view when clicking on a many2one, partner_id field?

I found this example here, but it isn't working for me:  


Thank you for your help

Andre de Kock
On 7/1/15, 8:30 AM

You can do this by adding context on the field in XML.

<field name="m2o_field" context="{'form_view_ref': 'module_name.view_name'}" />

Alternatively, the answer in the link you gave is also correct.

<field name="m2o_field">
        <!-- form view here -->

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: 6/30/15, 11:47 AM
Seen: 2857 times
Last updated: 8/2/16, 8:34 AM