From f79582c1f819fd3751916ae99ee61586038c59a5 Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Mon, 6 May 2019 09:49:05 +0000 Subject: [FIX] mail: prevent record discard on new attachment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Open a record having a chatter, edit a field, add an attachment, leave the page. The discard warning popup in not shown. When an attachment is added, it reloads the record to fetch the new `attachment_message_count`. Reloading the view was discarding the changes because the `keepChanges` option was not set and defaults to `false`. The changes were discarded thus the internal `_isDirty` flag evaluated to `false` thus the popup was not shown as nothing would have been saved. The option was set in another `attachment_message_count` reload already, in `chatter.js@_openComposer`. opw-1974147 closes odoo/odoo#33180 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/js/chatter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/mail/static/src/js/chatter.js') diff --git a/addons/mail/static/src/js/chatter.js b/addons/mail/static/src/js/chatter.js index 5f9b11198e3..dc23354fe7b 100644 --- a/addons/mail/static/src/js/chatter.js +++ b/addons/mail/static/src/js/chatter.js @@ -365,7 +365,7 @@ var Chatter = Widget.extend({ this._fetchAttachments().then(this._openAttachmentBox.bind(this)); } if (this.fields.thread) { - this.trigger_up('reload', { fieldNames: ['message_attachment_count'] }); + this.trigger_up('reload', { fieldNames: ['message_attachment_count'], keepChanges: true }); } }, /** -- cgit v1.2.3