As the name suggests, this view type presents the records in a calendar that can be viewed for month, week, or days periods of time. A calendar view for the To-Do Tasks could look like this:
<record id="view_calendar_todo_task" model="ir.ui.view"> <field name="model">todo.task</field> <field name="arch" type="xml"> <calendar date_start="date_deadline" color="user_id" display="[name], Stage [stage_id]" > <!-- Fields used for the display text --> <field name="name" /> <field name="stage_id" /> </calendar> </field> </record>
The calendar attributes are:
date_start
is the field for the start date. Mandatory.date_end
is the field for the end date. Optional.date_delay
is the field with the duration in days, that can be used instead of date_end
.all_day
provides the name of a Boolean field that is to be used to signal full day events. In these events, the duration is ignored.color
is the field used to group color the calendar entries. Each distinct value in this field will be assigned a color, and all its entries will have the same color.display
is the display text for each calendar entry. It can user record values using the field names between square brackets, such as [name]
. These fields must be declared as child of the calendar element, an in the preceding example.mode
is the default display mode for the calendar, either day
, week
, or month
.