Calendar and gantt views
This recipe walks you through how to display and edit information about dates and duration in your records in a visual way.
How to do it...
- Define a calendar view:
<record id="calendar_project_task" model="ir.ui.view"> <field name="model">project.task</field> <field name="arch" type="xml"> <calendar date_start="date_start" date_stop="date_end" color="project_id"> <field name="name" /> <field name="user_id" /> </calendar> </field> </record>
- Add menus and actions using this view. This is left as an exercise for the reader.
How it works...
The calendar view needs to be passed field names in the date_start
and date_stop
attributes to indicate which fields to look at when building the visual representation. Use fields of the Datetime
type, as everything else will get you weird results. While date_start
is required, you can leave out date_stop...