Odoo Help

0

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

By
Alejandro Santana
on 1/14/15, 9:17 AM 2,299 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"?

1

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.

Register

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)

Stats

Asked: 1/14/15, 9:17 AM
Seen: 2299 times
Last updated: 3/16/15, 8:10 AM