Managing chatter on documents
In this recipe, you will learn how to manage chatter on your documents and add a communication thread to a record.
Getting ready
For this recipe, we will reuse the my_library
module from Chapter 8, Advanced Server-Side Development Techniques. You can grab an initial copy of the module from the Chapter23/
00_initial_module
directory of the GitHub repository for this book. In this recipe, we will add chatter to the library.book.rent
model.
How to do it...
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 thelibrary.book.rent
model:class LibraryBookRent(models.Model): Â Â Â Â _name = 'library.book.rent' Â Â Â Â _inherit = ['mail.thread'] ...
- Add chatter widgets on the form view...