Graph and Calendar view is a very useful view in OpenERP. Calendar view allows us to see an “agenda” like of documents. Graph view will show a snapshot of statistics performed by the document.

Example below is the Calendar view of Session model:


cal

 

And this is the Graph view showing the total number of attendees per Course:

graph

 

 

Create XML records for Calendar view

Add a new XML record with element of <calendar>

 

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

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

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

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

<calendar string=”Session” date_start=”start_date”>

<field name=”name”/>

</calendar>

</field>

</record>

 

 

Create record for Graph view

Add a new XML record with element of <calendar>

 

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

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

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

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

<graph string=”Session” type=”bar”>

<field name=”instructor_id”/>

<field name=”seats” operator=”+”/>

</graph>

</field>

</record>

 

 

Setup button on act_window to show Graph and Calendar icon

 

Then setup the graph view icon form the action window for the model:

 

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

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

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

         <field name=”view_mode”>tree,form,calendar,graph</field>

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

<field name=”help” type=”html”>

<p>session help information</p>

</field>

</record>

Creating Graph and Calendar View in OpenERP 7.0