Chapter 6 - Odoo 15 Development Book

Activity View

We know that, Odoo supports several views such as tree view, form view, list view, Kanban view, pivot view, calendar view, activity view etc. Activity view helps the user to manage every business operation. Its root element is <activity>.

In this view we get information on all activities that are linked with our record. It contains rows and columns. And all the records are in rows and activities are in columns.

Let’s create an activity view:

In the manifest field, first we need to add the dependencies.

'depends': ['mail'],

And we need to inherit mail.thread and mail.activit.mixin models

Created a model book.

class Book(models.Model):
   _name = 'book'
   _inherit = ['mail.thread', 'mail.activity.mixin']
   display_name = fields.Char(string='Name', required=True)
   author = fields.Many2one('res.users', 'Author', required=True)
   sl_no = fields.Char('Sl No', required=True)

Created an action for this model

<record id="action_Book" model="ir.actions.act_window">
    <field name="name">Book</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">book</field>
    <field name="view_mode">tree,form,activity</field>

This is the activity view of this model

<record id="view_activity_book" model="ir.ui.view">
  <field name="name">Book</field>
  <field name="model">book</field>
  <field name="arch" type="xml">
        <activity string="Applicants">
                  <div t-name="activity-box">
                            <field name="display_name"/>


Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message