How to Create a Calendar View in Odoo 18

Hello Odooers & Developers!

Get started with this hands-on guide to Odoo..! In this article, we'll learn how to create a Calendar View in Odoo 18. The calendar view is an excellent tool for showing records based on dates perfect for scheduling, managing appointments, tasks, and tracking essential deadlines. Odoo 18  introduced a much-improved calendar view that helps businesses manage their time and resources more effectively. It includes an easy-to-use interface, intelligent scheduling, resource planning, integration with other Odoo apps, flexible customization, and mobile access. Whether you're part of a sales team, a project manager, or handling resources, the calendar view in Odoo helps boost productivity and keep things running smoothly.

What You Will Learn in This Guide:

  • What is a Calendar View in Odoo?
  • How to define a Calendar View using XML
  • How do you configure fields for the calendar (start, color, etc.)?
  • Practical example with a custom model
  • How to add calendar view to menus and actions

What is a Calendar View in Odoo?

A Calendar View in Odoo displays records using a calendar interface. Each record is placed on the calendar based on date fields like start_date. This view helps manage appointments, events, tasks, bookings, or time-based operations.

Standard modules that use the calendar view include:

First, we must create the model and add the necessary fields for the calendar view. We can design the calendar layout once the model and fields are ready.


Step-by-Step: Create a Calendar View in Odoo

Let's go through creating a Calendar View with a custom example.

Example Use Case:

We'll build a custom module that manages decoration bookings. The model will have booking dates, and a calendar view will help us track all orders by date.

1. Create the Model

We start by defining our custom model: decoration.order.

.py

# models/decoration_order.py
from odoo import models, fields, api
class DecorationOrder(models.Model):
    _name = 'decoration.order'
    _description = 'Decoration Order'
    name = fields.Char(string='Order Number', default='New', 
​readonly=True)
    partner_id = fields.Many2one('res.partner', string='Customer')
    start_date = fields.Datetime(string='Start Date', required=True)
    end_date = fields.Datetime(string='End Date')
    color = fields.Integer(string='Color Index')  
​ # Used in calendar view for color
    note = fields.Text(string='Booking Note')

2. Define the Calendar View in XML

Next, we define the calendar view in XML. It goes in your views/decoration_order_views.xml file.

<!-- views/decoration_order_views.xml -->

XML

<odoo>

   <record id="view_dev_decoration_order_calendar" model="ir.ui.view">
    	<field name="name">view.dev.decoration.order.calendar</field>
    	<field name="model">decoration.order</field>
    	<field name="arch" type="xml">
        	<calendar string="Decoration Orders"
                  	date_start="event_date"
                  	color="user_id">
            	<field name="name"/>
            	<field name="user_id" avatar_field="image_128"/>
            	<field name="state"/>
        	</calendar>
    	</field>
	</record>

</odoo>

Explanation of Key Attributes:

  • string="Decoration Orders"
    ➤ This is the title displayed on the calendar tab in the Odoo UI.
  • date_start="event_date"
    ➤ This tells Odoo which field in the model stores the start date/time of the event.
    ➤ It's required.
    ➤ In this case, event_date is the field used for the starting time of a decoration order.
  • color="user_id"
    ➤ Adds color coding to events based on the user_id.
    ➤ Each user will have a different color, helping to visually group tasks by user.

3. Add an Action and Menu Item

We need to link the calendar view with a menu and action so users can access it from the Odoo UI.

XML

<odoo>

    <record id="action_decoration_order_calendar"
​ model="ir.actions.act_window">
        <field name="name">Decoration Calendar</field>
        <field name="res_model">decoration.order</field>
        <field name="view_mode">calendar,tree,form</field>
        <field name="help" type="html">

<p class="o_view_nocontent_smiling_face">Schedule decoration orders on the calendar!</p>
        </field>
    </record>
    <menuitem id="menu_decoration_root" name="Decoration"/>
<menuitem id="menu_decoration_order" name="Orders" parent="menu_decoration_root"/>
   <menuitem id="menu_decoration_calendar" name="Calendar" parent="menu_decoration_order"
              action="action_decoration_order_calendar"/>
</odoo>

Testing Your Calendar View

After restarting your Odoo server and upgrading the module:

  1. Go to the Decoration menu → Orders → Calendar.
  2. You will see a calendar interface.
  3. Add new decoration bookings by clicking on calendar slots.
  4. View details and drag and drop to change booking dates if editable.

Now, let's take a look at the view. You'll notice that a calendar icon has been added to it.

When we click on the calendar view, we can see the records shown on the calendar.

The colored area shows that there are records on that date. The records are shown in the image by month, but we can also switch to day, week, or year view.

Security Access Rules

Ensure your model has proper access rights.

CSV

# security/ir.model.access.csv
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
Access_decoration_order_user,access.decoration.order.user,model_decoration_order,,1,1,1,1

Conclusion

Creating a calendar view in Odoo 18 with Devintellecs is an easy method to visualize your data and make it more usable. With only a few lines of XML, you can convert your records, like orders, tasks, or appointments, into an interactive calendar.

This data view lets users plan, schedule, and monitor activities based on dates and timelines, thus their workflow. You can easily customize the view by editing events directly, adding new ones quickly, or switching between different display modes like day, week, and month.


Odoo DEV May 12, 2025
Share this post
Archive
Sign in to leave a comment
How to Create Smart Buttons in Odoo 18