Book Image

Odoo Development Essentials

Book Image

Odoo Development Essentials

Overview of this book

Table of Contents (17 chapters)
Odoo Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Search views


The search options available on views are defined with a search view. It defines the fields to be searched when typing in the search box It also provides predefined filters that can be activated with a click, and data grouping options for the records on list and kanban views.

Here is a search view for the to-do tasks:

<record id="todo_app.view_filter_todo_task"
        model="ir.ui.view">
  <field name="name">To-do Task Filter</field>
  <field name="model">todo.task</field>
  <field name="arch" type="xml">
    <search>
      <field name="name" filter_domain="['|',
          ('name','ilike',self),('user_id','ilike',self)]"/>
      <field name="user_id"/>
      <filter name="filter_not_done" string="Not Done"
              domain="[('is_done','=',False)]"/>
      <filter name="filter_done" string="Done"
              domain="[('is_done','!=',False)]"/>
      <separator/>
      <filter name="group_user" string...