Odoo Help


How to open a custom view from a Many2one field in another view?

Alejandro Santana
on 1/14/15, 9:17 AM 2,830 views

In Odoo v8, I have extended crm.lead model to add some fields. Also created specific menu and views to show them differently than through original Lead/opportunities menus and views.

I have other model "A", and they have a m2o/o2m relationship, so I can go back and forth.

But, whenever I click on model "A" m2o field "crm_lead_id", the default lead view is opened, but I need to open my customized view (to see extra fields).

How do I specify it for model "A" m2o field "crm_lead_id"?


Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.


Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 


We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :


  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 1/14/15, 9:48 AM

In that many2one field 'crm_lead_id' try to pass the 'context' as below:

<field name="crm_lead_id"
context="{'search_view_ref':'<<your search view name along with the modulename - modulename.viewname>>',
        'tree_view_ref':'<<your tree view name along with the modulename - modulename.viewname>>'
'form_view_ref':'<<your form view name along with the modulename - modulename.viewname>>'}"/>

Hope this helps !!.

It is not working so far. I am trying to type the refs with and without module (which is current module), with and without character '.

Anubía, soluciones en la nube, S.L., Alejandro Santana
on 1/14/15, 2:57 PM

Is it giving any error? Can you post your changes view? Try to find the example that I suggested. I am sure this will help you. This thing works fine at our side.

Emipro Technologies Pvt. Ltd.
on 1/15/15, 12:06 AM

It fails without error. I see no errors in logs (with DEBUG level), but it just ignores the context. So when I click on 'lead_id' it opens the original crm.lead form, instead the one I specified. I have double-checked the ids of views, but no luck. So, I see nothing weird... but context is ignored, it seems. Module name: The python field definition: crm_ticket_platforms lead_id = fields.Many2one( 'crm.lead', string='Lead', select=True, ondelete='restrict' ) And the XML where I put the field: Any idea?

Anubía, soluciones en la nube, S.L., Alejandro Santana
on 2/12/15, 10:23 PM

@Anubia, im facing the same problem here

Omal Bastin
on 3/21/15, 4:31 PM

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: 1/14/15, 9:17 AM
Seen: 2830 times
Last updated: 3/16/15, 8:10 AM