Logging user changes in a chatter
The Odoo framework provides a built-in facility to log field changes in a chatter. In this recipe, we will enable logging on some of the fields so that when changes are made in them, Odoo will add logs in the chatter.
Getting ready
For this recipe, we will be using the my_hostel
module from the previous recipe, Managing the email alias. In this recipe, we will log changes from a few fields in the hostel.student
model.
How to do it...
Modify the definitions of the fields, to enable logs for the fields when you change them. This is shown in the following code snippet:
class HostelStudent(models.Model): Â Â Â _name = "hostel.student" Â Â Â _description = "Hostel Student Information" Â Â Â _inherit = ['mail.thread', 'mail.activity.mixin'] Â Â Â name = fields.Char("Student Name") Â Â Â email = fields.Char("Student Email"...