Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6430 มุมมอง
For example, there are two models:
sale.order and purchase.order
Where we can select a product from the filtered list  of products using one of your favorite filter by pressing on "Search more..."
How to set one filter for the first model, and another for the second model, if they standard for both?
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Gleb,

You can do it by passing the default search filter in the context of the o2m field in XML file by inheriting the view of related object.

Ex:

<xpath expr="//field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
    <attribute name="context">{'search_default_ur_filter_name': 1}</attribute> # Here you need to add the original context from the base view as well
</attributes>


อวตาร
ละทิ้ง
ผู้เขียน

Thanks for the answer

I understand how to do it through the widget)

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ย. 23
3090
7
เม.ย. 21
20443
filter with related model field แก้ไขแล้ว
1
ต.ค. 20
4832
change search filter แก้ไขแล้ว
2
พ.ย. 16
4192
Search with functional fields แก้ไขแล้ว
4
มี.ค. 15
21124