Odoo Help


opportunities in lead field one2many 6.1

on 4/26/13, 8:42 AM 1,714 views


In crm.lead i go with somethink like this:

_inhrerit = 'crm.lead'
_columns = {
'parent_id': fields.many2one('crm.lead', 'Parent', ondelete='cascade'),
'opportunity_ids': fields.one2many('crm.lead','parent_id','Opportunities', domain=[('type','=','opportunity')]),

in Leads Form View i have added

<field name="opportunity_ids" />

It works but i need view from opportunity, not lead. I see this field in my view but it shows me like 'lead tree view' and after click 'create' button i see 'lead form view' - not opportunity. How to change it to opportunity tree/form view?

Tech Receptives
On 4/26/13, 9:07 AM

in context just pass {'default_tree_view': <xml id of required tree view>, 'default_form_view:<xml id of required form view>}

Code: > {'default_tree_view': <xml id of required tree view>, 'default_form_view:<xml id of required form view>}

doesnt work. After couple of hours I've found solution here: http://doc.openerp.com/v6.0/developer/2_6_views_events/views/specify_view_to_use.html

context="{'form_view_ref' : 'module.view_id', 'tree_view_ref' : 'model.view_id'}"
on 4/26/13, 10:30 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

0 follower(s)


Asked: 4/26/13, 8:42 AM
Seen: 1714 times
Last updated: 3/16/15, 8:10 AM