Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2721 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 6 23
2909
1
thg 2 23
2350
1
thg 4 25
1471
2
thg 8 24
4178
2
thg 1 24
2057