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', 'Borrower', required=True)
state = fields.Selection([('ongoing', 'Ongoing'), ('returned', 'Returned')],
'State', default='ongoing', required=True,
track_visibility='always')
rent_date = fields.Date(default=fields.Date.today, track_visibility='onchange')
return_date = fields.Date(track_visibility='onchange')

Update the my_library module to apply the changes. Create a new record in the library.book.rent model, make some changes in the fields, and then return the book. If you check the chatter, you will see the following logs:

Whenever you make changes to state, rent_date, or return_date, you will see a new log in the chatter. This will help you to see the full history of the record.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset