diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-09-22 16:30:09 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-09-23 10:35:56 +0000 |
| commit | 201ba2518a5a1a95fdedfcd4235d93f64702a8ef (patch) | |
| tree | 3eb019a24530f8eb4b04bcbc91e7335e0caf4e0f /addons/mail/static/src/models/thread/thread.js | |
| parent | f6e67650e8cb1f8f0be9e90dbaccf45692816c3e (diff) | |
[FIX] mail: allow to open record thread in chat window
task-2171885
closes odoo/odoo#58318
X-original-commit: af6e68c2c5bd819402af0126c87f375e096c8d0d
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/thread/thread.js')
| -rw-r--r-- | addons/mail/static/src/models/thread/thread.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index a1818376233..bed46a7f41b 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -631,16 +631,22 @@ function factory(dependencies) { * @param {boolean} [param0.expanded=false] */ async open({ expanded = false } = {}) { + const discuss = this.env.messaging.discuss; // check if thread must be opened in form view if (!['mail.box', 'mail.channel'].includes(this.model)) { - return this.env.messaging.openDocument({ - id: this.id, - model: this.model, - }); + if (expanded || discuss.isOpen) { + // Close chat window because having the same thread opened + // both in chat window and as main document does not look + // good. + this.env.messaging.chatWindowManager.closeThread(this); + return this.env.messaging.openDocument({ + id: this.id, + model: this.model, + }); + } } // check if thread must be opened in discuss const device = this.env.messaging.device; - const discuss = this.env.messaging.discuss; if ( (!device.isMobile && (discuss.isOpen || expanded)) || this.model === 'mail.box' |
