[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#84085

X-original-commit: ddfcee8f35da4bcf16f258d1bdfd0cf08436d001
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Sébastien Theys
2022-02-07 15:25:03 +00:00
parent 30a92426e1
commit 96e355bcca
@@ -105,7 +105,7 @@ registerModel({
});
return;
}
return this.messaging.models['Attachment'].insert({
return (composer || thread).messaging.models['Attachment'].insert({
composer: composer && replace(composer),
originThread: (!composer && thread) ? replace(thread) : undefined,
...attachmentData,