110 April 2012OpenERP Community, Customers and Partners summit
OpenChatter and mail integration
Thibault Delavallée
10 April 2012OpenERP Community, Customers and Partners summit
Introduction
● Being Social … what is it ?
10 April 2012OpenERP Community, Customers and Partners summit
Introduction
● Being Social … what is it ?
– more Facebook posts than
emails sent
– companies using Twitter average
2 times more leads
– networking through social medias
more and more crucial
→ not only Buzz !
10 April 2012OpenERP Community, Customers and Partners summit
Introduction
● Being Social … what is it ?
– more Facebook posts than
emails sent
– companies using Twitter average
2 times more leads
– networking through social medias
more and more crucial
→ not only Buzz !
● People have incorporated social media in their lifes
● What about companies ?
10 April 2012OpenERP Community, Customers and Partners summit
Introduction
● Daily life in a company ...
– invoices to send, receive, (re)encode, phonecalls, emails, …
→ inefficient !
– still struggling with stone age !
● This process should be improved …
● … and OpenERP will do it !
10 April 2012OpenERP Community, Customers and Partners summit
Introduction
● Daily life in a company ...
– invoices to send, receive, (re)encode, phonecalls, emails, …
→ inefficient !
– still struggling with stone age !
● This process should be improved …
● … and OpenERP will do it !
OpenChatter, a new social feature !
10 April 2012OpenERP Community, Customers and Partners summit
What is OpenChatter ?
● Because a demo is worth a thousand words …
10 April 2012OpenERP Community, Customers and Partners summit
What is OpenChatter ?
● Because a demo is worth a thousand words …
● Summary
– collection of mail.message
– managed by mail.thread
– possibly overridden by the addon
– displayed through Thread and Wall widgets
● Let's dive into some technical aspects !
10 April 2012OpenERP Community, Customers and Partners summit
What is OpenChatter ?
● Transparent messaging system
● Discussions about documents
● Integration of emails
● System notifications and res logs cleaning
● Threaded design
● Discussion groups
● Easy internal and external user inclusion in a discussion
● Follow mechanism
● Central feeds page: Wall
● “Need action” mechanism
● Easy addon update to OpenChatter
10 April 2012OpenERP Community, Customers and Partners summit
Outline
● Introduction
● What is OpenChatter ?
● Internals and API
● Thread widget and Wall
● Share and invite
● Need action mechanism
● How to use OpenChatter in my addon ?
● Work in progess
● Conclusion
10 April 2012OpenERP Community, Customers and Partners summit
Outline
● Introduction
● What is OpenChatter ?
● Internals and API
● Thread widget and Wall
● Share and invite
● Need action mechanism
● How to use OpenChatter in my addon ?
● Work in progess
● Conclusion
10 April 2012OpenERP Community, Customers and Partners summit
mail.message
● Models every kind of message, not just emails
● type: notification, comment, email
– notification: state update, stage change, logs
→ no more res.log
→ screen cleaning
– comment: user comments
– email: emails going from and to the mail gateway
10 April 2012OpenERP Community, Customers and Partners summit
mail.message
● Models every kind of message, not just emails
● type: notification, comment, email
● subtype: plain, html → body_text, body_html
– body: calculated body matching subtype
– comments and notifications in html
10 April 2012OpenERP Community, Customers and Partners summit
mail.message
● Models every kind of message, not just emails
● type: notification, comment, email
● subtype: plain, html
● threaded design: parent_id
10 April 2012OpenERP Community, Customers and Partners summit
mail.message
● Models every kind of message, not just emails
● type: notification, comment, email
● subtype: plain, html
● threaded design: parent_id
● email API
10 April 2012OpenERP Community, Customers and Partners summit
mail.thread
● mixin class
– holds API methods !
– message_ids field disappeared
– temporary field for web-client widget display and GTK-client compatibility
10 April 2012OpenERP Community, Customers and Partners summit
mail.thread
● Thread management
10 April 2012OpenERP Community, Customers and Partners summit
mail.thread
● Thread management
● Subscription management
10 April 2012OpenERP Community, Customers and Partners summit
mail.thread
● Thread management
● Subscription management
● Notification and Wall management
10 April 2012OpenERP Community, Customers and Partners summit
mail.subscription
● Models user subscriptions to records
– many2many-like: user_id, res_model, res_id
10 April 2012OpenERP Community, Customers and Partners summit
mail.subscription
● Automatic subscription
– when creating/updating a record
– when posting a comment
● Manual subscription
– Follow / unfollow buttons
– Invite button
10 April 2012OpenERP Community, Customers and Partners summit
mail.subscription
● Subscription API in mail.thread
10 April 2012OpenERP Community, Customers and Partners summit
mail.notification
● Models notifications pushed to users to display the Wall
– many2many: user_id, message_id
● Push
– user follows a record
– user is requested in message body (@login)
– user is requested to perform an action (ir.needaction)
10 April 2012OpenERP Community, Customers and Partners summit
Outline
● Introduction
● What is OpenChatter ?
● Internals and API
● Thread widget and Wall
● Share and invite
● Need action mechanism
● How to use OpenChatter in my addon ?
● Work in progess
● Conclusion
10 April 2012OpenERP Community, Customers and Partners summit
Thread widget
● Everything contained in mail addon
→ nice example of the new web client possibilities !
● Thread widget: handles the display of a thread of messages
10 April 2012OpenERP Community, Customers and Partners summit
Thread widget
● Everything contained in mail addon
→ nice example of the new web client possibilities !
● Thread widget: handles the display of a thread of messages
● ThreadView widget: handles the display of OpenChatter on a document
– messages thread
– actions
– followers
10 April 2012OpenERP Community, Customers and Partners summit
Feeds page: Wall
● Client action, calling the Wall widget
● Shows recent threads
● Manage threads
– hide: delete notification
– delete: delete message if owner
– start a discussion
– reply: add a reply to the thread
10 April 2012OpenERP Community, Customers and Partners summit
Outline
● Introduction
● What is OpenChatter ?
● Internals and API
● Thread widget and Wall
● Share and invite
● Need action mechanism
● How to use OpenChatter in my addon ?
● Work in progess
● Conclusion
10 April 2012OpenERP Community, Customers and Partners summit
Share and invite
● Share extends mail.thread
→ add an Invite button and a new feature to OpenChatter
● Invite mechanism based on share
– simplified process, only give emails
– creates shared users if email not in database
– subscribes users to document
– pushes notifications
10 April 2012OpenERP Community, Customers and Partners summit
Outline
● Introduction
● What is OpenChatter ?
● Internals and API
● Thread widget and Wall
● Share and invite
● Need action mechanism
● How to use OpenChatter in my addon ?
● Work in progess
● Conclusion
10 April 2012OpenERP Community, Customers and Partners summit
Need action mechanism
● Ex: hr_holidays waiting validation
– notify manager
– counters in menu
10 April 2012OpenERP Community, Customers and Partners summit
Need action mechanism
● Ex: hr_holidays waiting validation
– notify manager
– counters in menu
● ir.needaction_mixin
res_model res_iduser_id
● update record
10 April 2012OpenERP Community, Customers and Partners summit
Need action mechanism
● Ex: hr_holidays waiting validation
– notify manager
– counters in menu
● ir.needaction
res_model res_iduser_id
● update record
● get_needaction_user_ids
10 April 2012OpenERP Community, Customers and Partners summit
Need action mechanism
● Ex: hr_holidays waiting validation
– notify manager
– counters in menu
● ir.needaction
res_model res_iduser_id
User Document
● update record
● get_needaction_user_ids
● update table
10 April 2012OpenERP Community, Customers and Partners summit
Outline
● Introduction
● What is OpenChatter ?
● Internals and API
● Thread widget and Wall
● Share and invite
● Need action mechanism
● How to use OpenChatter in my addon ?
● Work in progess
● Conclusion
10 April 2012OpenERP Community, Customers and Partners summit
Howto: use OpenChatter in my addon
● Easy as adding 2 lines of code !
10 April 2012OpenERP Community, Customers and Partners summit
Howto: use OpenChatter in my addon
● System notification: self.message_append_note
– calls message_append that handles message data
– calls message_create that
● creates the message● parses the body to find @login● pushes to users following the document
10 April 2012OpenERP Community, Customers and Partners summit
Howto: subscription management
● Ex: project manager should follow all its tasks
● Avoid doing it manually: override message_get_subscribers !
10 April 2012OpenERP Community, Customers and Partners summit
Howto: subscription management
● Ex: project manager should follow all its tasks
● Avoid doing it manually: override message_get_subscribers !
● Pro:
– small code addition to project.task
– changing the project manager automatically update the followers
● Con:
– project manager cannot unfollow its tasks …
– but he can hide notifications if necessary
10 April 2012OpenERP Community, Customers and Partners summit
Howto: control displayed messages
● ex: res.users OpenChatter should show
– messages related to this user (res.users, user_id)
– messages pushed to this user (contains @login)
● Override message_load !
10 April 2012OpenERP Community, Customers and Partners summit
Howto: notifications guidelines
● Avoid unnecessary content
– short sentences
– do not include record name
● User simple and clean style
– html tags supported → b, em
– Main word(s) in bold
● Easily include of someone in discussion: @login
10 April 2012OpenERP Community, Customers and Partners summit
Outline
● Introduction
● What is OpenChatter ?
● Internals and API
● Thread widget and Wall
● Share and invite
● Need action mechanism
● How to use OpenChatter in my addon ?
● Work in progess
● Conclusion
10 April 2012OpenERP Community, Customers and Partners summit
New features
● Attachments
– keep attachments linked to records
– add a link from a comment to an
attachment
10 April 2012OpenERP Community, Customers and Partners summit
New features
● Attachments
● Checklists
– embed checklists in comments
– on-the-fly creation and edition
– checks directly in comments
– see progression
10 April 2012OpenERP Community, Customers and Partners summit
New features
● Attachments
● Checklists
● Voting system
● Custom name_get for integrating in kanban views
● Polling new messages on the Wall
10 April 2012OpenERP Community, Customers and Partners summit
New features
● Open to remarks and suggestions !
● Open topics
– what do you need to see on the Wall ?
– sort notifications ?
– how to follow all sale orders ?
– action center ?
– ...
10 April 2012OpenERP Community, Customers and Partners summit
Outline
● Introduction
● What is OpenChatter ?
● Internals and API
● The Wall
● Share and invite
● Need action mechanism
● How to use OpenChatter in my addon ?
● Work in progess
● Conclusion
10 April 2012OpenERP Community, Customers and Partners summit
Conclusion
● Social not only a Buzzword !
● Still a long way to a good use of social features in companies
● OpenChatter
– centralizes notifications, comments and emails
– Feeds main page
– invite mechanism based on share
– integration with the mail gateway
– easy integration in addons !
10 April 2012OpenERP Community, Customers and Partners summit
Conclusion
Thank you for your attention !