How to create chatter with schedule activity in odoo ?

How to create chatter with schedule activity in odoo ?

  • if we want to add sent messages , log note , activities in the form view of the model then we have to create chatter. 
  • First we have to add the mail module in the dependent key in the manifest file of the module. Like below,


__manifest__.py

'depends': ['mail']

  •  now inherit the model in the model in which we want to add chatter. 

​Like below,


.py

_inherit  =   ['mail.thread.cc','mail.activity.mixin']


  • Now we have to write below things in the xml file of the model , in which we want to add chatter. 
  • This thing we have to add after the sheet tag.


.xml

<div class="oe_chatter">

                    <field name="message_follower_ids" widget="mail_followers"/>

                    <field name="activity_ids" widget="mail_activity"/>

                    <field name="message_ids" widget="mail_thread"/>

</div>


  • so by this code , chatter is added in the form view of the model.
  • If we want to create activity and want to show that activity then we have to create the activity view.

​Activity view is created the same as the tree view and form view. Then we have to add activity in the action record.

example:


.xml

<activity string="Activity view">

                <templates>

                    <div t-name="activity-box">

                        <div>

                            <field name="name"/>

                        </div>

                    </div>

</templates>

 </activity>



Tracking of records in the chatter

if we want to show an update message and create a message in the chatter then we have to add a tracking attribute in the field. 

example:


.py

name = fields.Char(string=“Restaurant name”,tracking=1)


  • we can write 1 or True in the tracking. 
  • We have to write this tracking attribute in the field in which we want to track record.
Odoo DEV February 1, 2024
Share this post
Archive
Sign in to leave a comment
Inheritance with different method in odoo