Odoo 16 Development Book

Activity view

One of the useful views that support Odoo is the activity view which helps the user to manage every business operation. In this view, we get information about the activities that are related to our records so that users can easily identify the scheduled activities.

First, we need to add “mail” to the depends Like, 'depends': ['mail'],

After adding the depends in the manifest, we need to inherit mail.thread and mail.activity.mixin models.

Model for an example,

class Activity(models.Model):
    _name = 'activity.demo'
    _inherit = ['mail.thread', 'mail.activity.mixin']
    name = fields.Char(string='Name', required=True)
    demo_field1 = fields.Many2one('res.users', 'Author', required=True)
    no = fields.Char('Sl No', required=True)

Action definition

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

Also the activity view define

<record id="demo_view_activity" model="ir.ui.view">
                                                        <field name="name">Book</field>
                                                        <field name="model">activity.demo</field>
                                                        <field name="arch" type="xml">
                                                              <activity string="Applicants">
                                                                  <templates>
                                                                        <div t-name="activity-box">
                                                                              <div>
                                                                                  <field name="name"/>
                                                                              </div>
                                                                        </div>
                                                                  </templates>
                                                              </activity>
                                                       </field>
                                                      </record>
location

Calicut

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

location

Kochi

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

location

Bangalore

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

Send Us A Message