Search code examples
odooodoo-9odoo-10

How to use Chatter in Odoo?


I want to use Chatter for students model, so that, when value of some field is changed then it is logged under student form

To achieve this, I did the following things: 1. Added this div

<div class="oe_chatter">
    <field name="message_follower_ids" widget="mail_followers"/>
    <field name="message_ids" widget="mail_thread"/>
</div>

in the student form.

It added the chatter, but when i clicked on New Message button, it gave the following error.

enter image description here

This could be because i haven't inherited mail.thread in student model.

  1. Then i inherited this class in student model.

enter image description here

Then it again gave an error as shown below

enter image description here

I search this topic, but couldn't found anything.

It would be appreciated if someone could help me out.


Solution

  • In order to log changes of specific fields you need so set the track_visibility attribute on each field you want to track:

    class OpStudent(models.Model):
        _name = 'op.student'
        _inherits = {
            'res.partner': 'partner_id',
        }
        _inherit = [
            'mail.thread',
            'ir.needaction_mixin',
        ]
    
        foo = fields.Char(track_visibility='always')
    

    You may read more about it in the official documentation.