Book Image

Odoo Development Essentials

Book Image

Odoo Development Essentials

Overview of this book

Table of Contents (17 chapters)
Odoo Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using inheritance to add social network features


The social network module (technical name mail) provides the message board found at the bottom of many forms, also called Open Chatter, the followers are featured along with the logic regarding messages and notifications. This is something we will often want to add to our models, so let's learn how to do it.

The social network messaging features are provided by the mail.thread model of the mail module. To add it to a custom model we need to:

  • Have the module depend on mail.

  • Have the class inherit from mail.thread.

  • Have the Followers and Thread widgets added to the form view.

  • Optionally, set up record rules for followers.

Let's follow this checklist:

Regarding #1, since our extension module depends on todo_app, which in turn depends on mail, the dependency on mail is already implicit, so no action is needed.

Regarding #2, the inheritance on mail.thread is done using the _inherit attribute we used before. But our to-do task extension class is already...