This question has been flagged
1 Reply
1126 Views

I have two models:

Model A is my custom module which has an employee_ids field which is a Many2many relationship with 'hr.employee'

Model B is an inherited model, hr.employee. I created two new custom tree views in my own hr_employee_views.xml file.


In the view of my custom module A i'm using the employee_ids field in a form. How do I specify which view it has to use from hr.employee? I want it to use a specific custom tree view inside the form of module A.

This is because I have two very similar custom tree views for hr.employee and I want to choose which one to use in particular modules...


How do I do this?


I've found two threads with similar questions, but I didn't manage to apply their solutions to my problem:

- https://www.odoo.com/forum/help-1/how-to-choose-form-view-used-by-many2one-field-in-openerp-v7-13709

- https://www.odoo.com/forum/help-1/how-to-choose-form-view-to-use-in-a-m2o-field-74081

Avatar
Discard
Best Answer

Hi,

If you want to specify the tree view for the field you can use

- tree_view_ref

<field name="product_ids" widget="one2many"  context="{'tree_view_ref' : 'module_name.view_id'}"/>

This will use this tree view in the form view

Regards

Avatar
Discard