O'Reilly logo

Odoo Development Cookbook by Daniel Reis, Alexandre Fayolle, Holger Brunn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calendar views

This recipe walks you through how to display and edit information about dates and durations in your records in a visual way.

How to do it...

  1. 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>
  2. 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 attributes date_start and date_stop to indicate which fields to look at when building the visual representation. Use fields of type Datetime as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required