Enable Dark Mode!
By: Cybrosys Technologies

Odoo Activity View


Odoo has different types of views for supporting the users. Views are used to define the records and how they should be displayed for the users. Moreover, the user can sort relevant data by using these views. Activity view is a type of view in Odoo, that helps the user to manage every business operation.
This blog is about the activity views and will describe how to create a new activity view. 
From the activity view of Odoo we get information on all activities that are linked to our records. The view is like a chart, It contains rows and columns and all the records are in rows and the activities are in columns. We can create a new activity view by the following steps:
    - First, we can add the dependency for the module first:
        Before creating an activity view we can create a module first. For that, we can configure the manifest file, and add ‘depends’ as ‘mail’.
‘depends’ : [‘mail’],
    - Next, we can create a new model activity.example:
We can inherit mail.thread and mail.activit.mixin models. These models are defined in the module mail therefore we will describe the ‘depends’ as mail in the manifest file as shown in the blow code:
	class ActivityViewExample(models.Model):
        _name = 'activity.example'
        _inherit = ['mail.thread', 'mail.activity.mixin']
        _description = 'Add Activity view'
        name = fields.Char(string="Name")
    - Now we can create views for the model:
Next we can define the activity view of the model activity.example. Where the <activity> is the root element and  inside the template tag we can give fields that want to be shown in the activity view as shown in the following image:
<record id="view_activity_example" model="ir.ui.view">
<field name="name">example.activity</field>
<field name="model">activity.example</field>
<field name="arch" type="xml">
<activity string="Applicants">
<div t-name="activity-box">
<field name="name"/>
    - Now we can define the tree view and the form view of the model:
Moreover, through the tree view and form view, we can edit the records.
Initially, lets understand on how to write the tree view: 
<record id="view_activity_example_tree" model="ir.ui.view">
<field name="name">activity.example.tree</field>
<field name="model">activity.example</field>
<field name="priority">2</field>
<field name="arch" type="xml">
<tree string="Overtime records">
<field name="name"></field>
Now we can move on to the form view:
<record id="view_activity_example_form" model="ir.ui.view">
<field name="name">activity.example.form</field>
<field name="model">activity.example</field>
<field name="arch" type="xml">
<form string="Study roadmap record">
<field name="name"></field>
<div class="oe_chatter">
<field name="message_ids" widget="mail_thread"></field>
<field name="activity_ids" widget="mail_activity"></field>
    - Next we have to create the action for the model:
We must need an action therefore, when clicking a menu it will open up the view which can be done as shown in the following code:
<record id="action_activity_example" model="ir.actions.act_window">
  <field name="name">Activity View</field>
  <field name="type">ir.actions.act_window</field>
  <field name="res_model">activity.example</field>
  <field name="view_mode">activity,tree,form</field>
    - We will need a menu item also:
The menu will be shown on the home screen which can be added by using the following commands:
<menuitem id="activity_example_root" name="Activity view" sequence="10"></menuitem>
    - At last we can give a security rule for the model:
We want to add a security file to access and edit the records which can be done just as follows:
After installing the module we will get activity view just as shown in the following image:
The activity view of the Odoo platform is a useful tool for business operations as it will list out the contents in an orderly way to put forward the elements to be well described to the users.

Odoo Training Package
Odoo Implementation Package

If you need any assistance in odoo, we are online, please chat with us.

cybrosys youtube


Leave a comment


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


Cybrosys Limited
Alpha House,
100 Borough High Street, London,
SE1 1LB, United Kingdom


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