Book Image

Odoo Development Cookbook

By : Holger Brunn, Alexandre Fayolle, Daniel Reis
Book Image

Odoo Development Cookbook

By: Holger Brunn, Alexandre Fayolle, Daniel Reis

Overview of this book

Odoo is a full-featured open source ERP with a focus on extensibility. The flexibility and sustainability of open source is also a key selling point of Odoo. It is built on a powerful framework for rapid application development, both for back-end applications and front-end websites. The book starts by covering Odoo installation and administration, and provides a gentle introduction to application development. It then dives deep into several of the areas that an experienced developer will need to use. You’ll learn implement business logic, adapt the UI, and extend existing features.
Table of Contents (23 chapters)
Odoo Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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 everything else will get you weird results. While date_start is required, you can leave out date_stop and set the attribute date_delay instead...