Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2778 มุมมอง

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 23
2937
1
ก.พ. 23
2374
1
เม.ย. 25
1525
2
ส.ค. 24
4217
2
ม.ค. 24
2072