diff options
| author | Alexandre Kühn <aku@odoo.com> | 2018-06-18 00:23:47 +0200 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2018-07-02 15:12:31 +0200 |
| commit | ed79f533a6d3373a90db2e1bf6e1095dbb086722 (patch) | |
| tree | 0f159aa7483e05c19f1a8bc89d7fc8a663cb7b94 /addons/mail/static/src/js/models/document_thread.js | |
| parent | cd34f6de727d5b3858420cff3c9d3c5995c4e75c (diff) | |
[IMP] mail: open document threads in thread windows
Also roughly called "open chatter in chat windows".
With this commit, document threads can now be detached in a small thread window.
It uses client-side cross-tab window synchronization by means of the local storage.
To detach a document thread in a thread window, click on the document thread preview
in the systray messaging menu when receving a new (needaction) document thread message.
-------------------------
Technical Limitations
-------------------------
1. In order to use this feature, the user must select the Notification Management
'Handle with Odoo' in the Preferences of the User settings (top-right menu).
2. For the moment, only needaction messages automatically updates the thread window. Manual
refresh is still needed for other kinds of messages (e.g. reload document record to fetch
new messages in the document thread).
Server-side code changes are required to receive new document thread message notifications on the
longpoll bus, which would fix the limitations above.
-------------------------
Future Works
-------------------------
1. Receive any new message from the document thread window when it is detached.
2. Log a note from the document thread window.
Task-33118
Diffstat (limited to 'addons/mail/static/src/js/models/document_thread.js')
| -rw-r--r-- | addons/mail/static/src/js/models/document_thread.js | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/addons/mail/static/src/js/models/document_thread.js b/addons/mail/static/src/js/models/document_thread.js index b9671107d9d..92cc26e845b 100644 --- a/addons/mail/static/src/js/models/document_thread.js +++ b/addons/mail/static/src/js/models/document_thread.js @@ -72,6 +72,47 @@ var DocumentThread = Thread.extend({ } }, /** + * Overrides to store the thread's state in the LocalStorage, so that it is + * shared between tabs, and restored on F5. + * + * @override + */ + close: function () { + this._super.apply(this, arguments); + this.call('mail_service', 'updateDocumentThreadState', this._id, { + name: this.getName(), + windowState: 'closed', + }); + }, + /** + * Overrides to store the thread's state in the LocalStorage, so that it is + * shared between tabs, and restored on F5. + * + * @override + */ + detach: function () { + this._super.apply(this, arguments); + var windowState = this._folded ? 'folded' : 'open'; + this.call('mail_service', 'updateDocumentThreadState', this._id, { + name: this.getName(), + windowState: windowState, + }); + }, + /** + * Overrides to store the thread's state in the LocalStorage, so that it is + * shared between tabs, and restored on F5. + * + * @override + */ + fold: function () { + this._super.apply(this, arguments); + var windowState = this._folded ? 'folded' : 'open'; + this.call('mail_service', 'updateDocumentThreadState', this._id, { + name: this.getName(), + windowState: windowState, + }); + }, + /** * Get the model name of the document that is linked to this document thread * * @returns {string} @@ -151,7 +192,7 @@ var DocumentThread = Thread.extend({ _.extend(messageData, { context: data.context, message_type: data.message_type, - subtype: data.subtype, + subtype: data.subtype || "mail.mt_comment", subtype_id: data.subtype_id, }); return self._rpc({ |
