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 when changes are made in them, Odoo will add the logs in the chatter.
Getting ready
For this recipe, we will be using the my_library
module from the previous recipe, Managing the email alias. In this recipe, we will log changes from a few fields in the library.book
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 LibraryBookRent(models.Model): Â Â Â Â _name = 'library.book.rent' Â Â Â Â _inherit = ['mail.thread', 'mail.activity.mixin'] Â Â Â Â book_id = fields.Many2one('library.book', 'Book', required=True) Â Â Â Â borrower_id = fields.Many2one('res.partner&apos...