Enable Dark Mode!
how-to-add-chatter-to-form-view-in-odoo-18.jpg
By: Adarsh K

How to Add Chatter to Form View in Odoo 18

Technical Odoo 18 Odoo Community

In Odoo 18, Chatter makes it easier for users to work together on records. Users may keep track of changes, add internal notes, and interact with coworkers and clients. This function improves communications both internally and externally and simplifies processes. Within Chatter, every communication history, action, and change is visible.

Chatter is usually found in the model's form view. The Chatter position attribute determines whether Chatter shows at the bottom or on the right side of the form view.

How to Add Chatter to Form View in Odoo 18-cybrosys

We will now discuss how to integrate Chatter with the form view. Since I haven't yet created the Chatter view, my custom model looks like this:

How to Add Chatter to Form View in Odoo 18-cybrosys

Now let's look at how to include Chatter into this form view.

The existing XML form views look like this:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
   <record id="employee_level_view_form" model="ir.ui.view">
       <field name="name">employee.level.view.form</field>
       <field name="model">employee.level</field>
       <field name="arch" type="xml">
           <form>
               <sheet>
                   <group>
                       <group>
                           <field name="level"/>
                           <field name="salary"/>
                       </group>
                       <group>
                           <field name="date"/>
                           <field name="team_head_id"/>
                       </group>
                   </group>
               </sheet>
           </form>
       </field>
   </record>
   <record id="employee_list" model="ir.ui.view">
       <field name="name">employee.list</field>
       <field name="model">employee.level</field>
       <field name="arch" type="xml">
           <list string="Channel">
               <field name="date"/>
               <field name="level"/>
               <field name="salary"/>
           </list>
       </field>
   </record>
   <record id="employee_action" model="ir.actions.act_window">
       <field name="name">Employee level</field>
       <field name="res_model">employee.level</field>
       <field name="view_mode">list,form</field>
   </record>
</odoo>

The first and most crucial step in adding a Chatter view is to inherit the "mail.thread" model in our custom model. Furthermore, we must include "mail" in the dependencies list in the manifest.

# -*- coding: utf-8 -*-
from odoo import api, fields, models

class EmployeeLevel(models.Model):
   """Main model of the module for creating the auctions and its properties"""
   _name = "employee.level"
   _description = "Employee Level"
   _order = "salary desc"
   _rec_name = "level"
   _inherit = ['mail.thread']
   level = fields.Char()
   salary = fields.Monetary(string='salary')
   currency_id = fields.Many2one("res.currency",
                                 string="Currency", required=True,
                                 default=lambda self:
                                 self.env.user.currency_id)
   date = fields.Date(string="Date", help="Date of maintenance request",
                      default=fields.Date.today)
   team_head_id = fields.Many2one('res.users',
                                  string='Team Leader',
                                  help="Head of the maintenance team")

Also, add the <chatter/> tag in XML like this.

<form>
   <sheet>
       <group>
           <group>
               <field name="level"/>
               <field name="salary"/>
           </group>
           <group>
               <field name="date"/>
               <field name="team_head_id"/>
           </group>
       </group>
   </sheet>
   <chatter/>
</form>

The newly added Chatter will be shown in the form view once the module has been upgraded.

Sending messages, adding log notes, attaching files, viewing followers, and following a record by clicking the follow button are all possible with Chatter.

How to Add Chatter to Form View in Odoo 18-cybrosys

It is possible to edit and erase the log notes from the lines. You can also respond with emojis, edit, and add to favorites.

How to Add Chatter to Form View in Odoo 18-cybrosys

Monitoring changes in fields

Because numerous users can access the same record in Odoo, it's critical to keep an eye on field updates. Odoo makes it possible to track field values, and Chatter will be alerted whenever there is a change.

As an example, I have the Team Leader field's tracking enabled.

team_head_id = fields.Many2one('res.users',
                              string='Team Leader',
                              help="Head of the team",
                              tracking=True)

A log will be added whenever the state of the record changes.

This illustrates how field changes can be tracked similarly.

How to Add Chatter to Form View in Odoo 18-cybrosys

Schedule activities from the chatter

On the basis of the discussion, we can also plan activities. In order to accomplish this, our custom model has to inherit the mail.activity.mixin model.

class EmployeeLevel(models.Model):
   """Main model of the module for creating the auctions and its properties"""
   _name = "employee.level"
   _description = "Employee Level"
   _inherit = ['mail.thread', 'mail.activity.mixin']

The Activities button was added to the Chatter after the module was upgraded. From this page, you can instantly create, mark as completed, alter, and cancel activities.

How to Add Chatter to Form View in Odoo 18-cybrosys

Likewise, Chatter can be applied to any form view to improve traceability and communication.

To read more about How to Add Chatter to Form View in Odoo 17, refer to our blog How to Add Chatter to Form View in Odoo 17.


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



0
Comments



Leave a comment



whatsapp_icon
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