跳至内容
菜单
此问题已终结
1 回复
2682 查看

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

形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
2
6月 23
2890
1
2月 23
2321
1
4月 25
1399
2
8月 24
4125
2
1月 24
2019