summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/composer/composer.js
diff options
context:
space:
mode:
authorXavier Dubuc <xdu@odoo.com>2020-07-08 13:52:53 +0000
committerAlexandre Kühn <aku@odoo.com>2020-07-15 16:18:53 +0000
commitc767df5e978f218cd0c1c7dc9219d3655e320fab (patch)
treee2139569a76bbc8b10ccf2ec47a887c2f50c6791 /addons/mail/static/src/models/composer/composer.js
parent04a757d59615c622ba808e4d5b0efc0ecf3190d0 (diff)
[FIX] mail: set full composer subject and recipients
task-2291887 task-2291893 task-2291898 closes odoo/odoo#54531 X-original-commit: 26170ad9ab09d75de2e0af98fb7daedc2ed57e50 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/composer/composer.js')
-rw-r--r--addons/mail/static/src/models/composer/composer.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js
index b4469043634..78e1ad4e505 100644
--- a/addons/mail/static/src/models/composer/composer.js
+++ b/addons/mail/static/src/models/composer/composer.js
@@ -4,6 +4,7 @@ odoo.define('mail/static/src/models/composer/composer.js', function (require) {
const emojis = require('mail.emojis');
const { registerNewModel } = require('mail/static/src/model/model_core.js');
const { attr, many2many, many2one, one2one } = require('mail/static/src/model/model_field.js');
+const mailUtils = require('mail.utils');
const {
addLink,
@@ -82,6 +83,43 @@ function factory(dependencies) {
}
/**
+ * Open the full composer modal.
+ */
+ async openFullComposer() {
+ const attachmentIds = this.attachments.map(attachment => attachment.res_id);
+
+ const context = {
+ default_attachment_ids: attachmentIds,
+ default_body: mailUtils.escapeAndCompactTextContent(this.textInputContent),
+ default_is_log: this.isLog,
+ default_model: this.thread.model,
+ /* FIXME would need to use suggested_partners here task-2280157 */
+ // default_partner_ids: partnerIds,
+ default_res_id: this.thread.id,
+ mail_post_autofollow: true,
+ };
+
+ const action = {
+ type: 'ir.actions.act_window',
+ res_model: 'mail.compose.message',
+ view_mode: 'form',
+ views: [[false, 'form']],
+ target: 'new',
+ context: context,
+ };
+ const options = {
+ on_close: () => {
+ if (!this.constructor.get(this)) {
+ return;
+ }
+ this._reset();
+ this.thread.loadNewMessages();
+ },
+ };
+ await this.env.bus.trigger('do-action', { action, options });
+ }
+
+ /**
* Post a message in provided composer's thread based on current composer fields values.
*/
async postMessage() {