how to place filter in search bar using xml code?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
4
Trả lời
58046
Lượt xem
how to place filter in search bar using xml code?
Hi,
See the below sample is given for the Products where you click on the menu the view will come with default filter Can be sold. In the Context, you can see how the default filter is set,
<field name="context">{"search_default_name_of_the_filter":1}</field>
The sample of the Product:
<record id="product_template_action" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,tree,form</field>
<field name="view_type">form</field>
<field name="view_id" ref="product_template_kanban_view"/>
<field name="context">{"search_default_filter_to_sell":1}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you sell, whether it's a physical product, a consumable or a service you offer to customers.
</p><p>
The product form contains information to simplify the sale process: price, notes in the quotation, accounting data, procurement methods, etc.
</p>
</field>
</record>
Thanks
Hello
see the example of the products.
xml code:
<!-- search view -->
<search>
<filter string="String" name="filter_name" domain="[('fieldname', 'operator', value)]"/>
</search>
into the action of menu, you have to pass the context like
<record id="xml_id" model="ir.actions.act_window">
<field name="context">{'search_default_filter_name': 1}</field>
</record>
how to apply that not in action? is that could apply without it?
its work thanks to both
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
3
thg 7 18
|
5925 | ||
|
3
thg 7 25
|
2187 | ||
|
1
thg 7 25
|
1705 | ||
|
1
thg 4 25
|
1443 | ||
|
2
thg 3 25
|
6832 |
For settings default filter in search view, see: https://www.youtube.com/watch?v=Q1i0vFXxGOE