From ff1de2a2b0679c5ac66e679841d63a5db9e3ec20 Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Thu, 28 Apr 2022 11:45:43 +0000 Subject: [PATCH] [FIX] mail: prevent crash when destroying during attachment upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File uploader might be deleted because it is linked to views, but the process of upload should still happen for the related thread. closes odoo/odoo#90102 X-original-commit: aa57c1804ecd9c88188e33c098b805f65f103a33 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/file_uploader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/models/file_uploader.js b/addons/mail/static/src/models/file_uploader.js index 38fbefbfb47..792599958a8 100644 --- a/addons/mail/static/src/models/file_uploader.js +++ b/addons/mail/static/src/models/file_uploader.js @@ -145,7 +145,7 @@ registerModel({ return; } try { - const response = await this.messaging.browser.fetch('/mail/attachment/upload', { + const response = await (composer || thread).messaging.browser.fetch('/mail/attachment/upload', { method: 'POST', body: this._createFormData({ composer, file, thread }), signal: uploadingAttachment.uploadingAbortController.signal,