Setting up Filters and Grouping in OpenERP 7.0

 Grouping and Filtering on OpenERP 7.0 now move to a simpler Search Panel. Example below is to filter and group Session object:


To make a filter panel, create a new record in the XML file with arch element of <search>

<record id=”view_session_filter” model=”ir.ui.view”>

<field name=”name”>session.filter</field>

<field name=”model”>my_openacademy.session</field>

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

<search string=”Search Session”>

<filter icon=”terp-mail-message-new” string=”Non zero duration”

name=”nonzero” domain=”[(‘duration’,’>’,0)]”/>


<field name=”instructor_id”/>

<field name=”name”/>


<group expand=”0″ string=”Group By…”>

<filter string=”Course” icon=”terp-personal”

domain=”[]” context=”{‘group_by’:’course_id’}”/>

<filter string=”Start Date” icon=”terp-personal” domain=”[]”







The above XML will add :

  • Non zero duration filter, to show only session with non zero duration
  • Allow searching by instructor
  • Allow searching by session name
  • Grouping session list by Course
  • Grouping session list by Start Date


Then from action window, optionally (if more than 1 search view), set it to search_view_id ( the XML record id that define the search panel above).

<record model=”ir.actions.act_window” id=”action_list_sessions” >

<field name=”name”>Sessions</field>

<field name=”res_model”>my_openacademy.session</field>

         <field name=”search_view_id” ref=”view_session_filter” />

<field name=”view_mode”>tree,form,calendar,graph,gantt</field>
<field name=”help” type=”html”>

<p>session help information</p>




Default filter that wil be selected when the list is opened, is set by this:


<field name=”context”>






<field name=”context”>