How it works...

In order to enable chatter on any model, you will need to install the mail module first. This is because all the code required to enable chatter or mailing capabilities is part of the mail module. That's why in step 1 we added the mail module dependency in the manifest file of the my_library module. This will automatically install the mail module whenever you install the my_library module.

The fields and methods required to operate chatter are part of the mail.thread model. The mail.thread model is an abstract model and is just used for inheritance purposes. In step 2, we inherited the mail.thread model in the library.book.rent model. This will add all the necessary fields and methods required for chatter in the library.book.rent model. If you don't know how model inheritance works, refer to the Using abstract models for reusable model features recipe in Chapter 5, Application Models.

In the first two steps, we added all the fields and methods required for chatter. The only remaining thing for chatter is adding a user interface in the form view. In step 3, we added a message thread and follower widget. You might be wondering about the message_follower_ids and message_ids fields. These fields are not added in the library.book.rent model definition but they are added from the mail.thread model through inheritance.

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

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