[FIX] mail: keep attachments when switching between note and message

Start a message mail (respectively note) in the chatter. Attach a file.
Switch to note (respectively mail). The attachment is lost.

With this commit, we keep the attachments after the switch.

opw 1925588

closes odoo/odoo#30197
This commit is contained in:
Nans Lefebvre
2019-01-14 14:54:47 +00:00
parent 8cba55ce31
commit 573ce17d0a
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -155,6 +155,7 @@ var Chatter = Widget.extend(chat_mixin, {
record_name: this.record_name,
default_body: old_composer && old_composer.$input && old_composer.$input.val(),
default_mention_selections: old_composer && old_composer.mention_get_listener_selections(),
attachment_ids: (old_composer && old_composer.get('attachment_ids')) || [],
});
this.composer.on('input_focused', this, function () {
this.composer.mention_set_prefetched_partners(this.mentionSuggestions || []);
+2 -1
View File
@@ -389,7 +389,7 @@ var BasicComposer = Widget.extend(chat_mixin, {
// Attachments
this.AttachmentDataSet = new data.DataSetSearch(this, 'ir.attachment', this.context);
this.fileupload_id = _.uniqueId('o_chat_fileupload');
this.set('attachment_ids', []);
this.set('attachment_ids', options.attachment_ids || []);
// Mention
this.mention_manager = new MentionManager(this);
@@ -449,6 +449,7 @@ var BasicComposer = Widget.extend(chat_mixin, {
dom.autoresize(this.$input, {parent: this, min_height: this.options.input_min_height});
// Attachments
this.render_attachments();
$(window).on(this.fileupload_id, this.on_attachment_loaded);
this.on("change:attachment_ids", this, this.render_attachments);