[FIX] mail: prevent crash when destroying during attachment upload

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) <seb@odoo.com>
This commit is contained in:
tsm-odoo
2022-04-29 13:13:04 +02:00
parent 2617b3f072
commit ff1de2a2b0
@@ -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,