I have a pivot table and when I click an entry, it opens to the default tree view defined on the model. I have a custom tree view I want to use with this pivot table. But I do not want this custom view to replace the default view on other actions.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
There are two ways that Odoo can be instructed to look for a particular view when a User navigates to a Menu:
1. Specify the View Ref for the default view (in this case the Tree/List View from the Quotations Menu):
2. Specify the Views the Action will use (in this case specific Views from the Sales Menu):
These two Actions show data from the same sale.order model differently, depending on which Menu you select.
Note: In these screenshots it appears that both Actions leverage the same View because it has the same name, but Quotations is actually using the View with External ID sale.view_quotation_tree and Sales is using the View with External ID sale.view_order_tree
I found a solution. You need to override the fields_view_get method on the model. You can match using the 'pivot_view_ref' key in the context dictionary. Here is an example:
@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
view_ref = self.env.context.get('pivot_view_ref', None)
if view_ref == '<view_name>' and view_type == 'tree':
ref = self.env.ref('<model>.<view_name>')
return super().fields_view_get(view_id=ref.id, view_type=view_type, toolbar=toolbar, submenu=submenu)
else:
return super().fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
3
เม.ย. 25
|
4544 | ||
|
1
ก.ค. 24
|
29 | ||
|
5
พ.ย. 23
|
42899 | ||
Create dynamic tree view
แก้ไขแล้ว
|
|
3
ก.ย. 23
|
9416 | |
|
2
ส.ค. 23
|
2015 |