Follow these steps to add chatter on the records of the library.book.rent model:
- Add the mail module dependency in the __manifest__.py file:
...
'depends': ['base', 'mail'],
...
- Inherit mail.thread in the Python definition of the library.book.rent model:
class LibraryBookRent(models.Model):
_name = 'library.book.rent'
_inherit = ['mail.thread']
...
- Add chatter widgets on the form view of the library.book.rent model:
...
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
...
Install the my_library module to see the changes in action:
As shown in the preceding screenshot, after installing the module you will be able to see chatter in the form view.