+2 votes
21 views
I need to create a search view in odoo, any suggestion ?
in Back-end by (10.5k points) | 21 views

1 Answer

+3 votes
Best answer

odoo search view customise the search field associated with the list view.
The root element of search view is search. field, filter and group by will be used in search view to analysis and quick search the data from list view

For Example :

<record model="ir.ui.view" id="view_id">

     <field name="name">view.name</field>

     <field name="model">model_name</field>

     <field name="priority" eval="14"/>

     <field name="arch" type="xml">

     <search name=”Search Name“>

          <field name=”field_1”/>

          <field name=”field_2”/>

     </search>

     </field>

</record>

For Example:
Define domain in search view by default using filter element.

<search>

    <field name=”field_1”/>

    <field name=”field_2”/>

    <filter name=’field_1’ domain=[(‘field_1’,’=’, True)] string=”filter label”/>

    <filter string="Invoice Date" context="{'group_by':'field_1'}"/>

</search>
by (8.8k points)
selected by
202 questions
178 answers
34 comments
115,580 users