[FIX] mail: allow uploading same attachment twice

Before this commit, when uploading an attachment then delete
then re-upload attachment again, the reupload was unsuccessful.

This happens because it should clear the `<input>` of type `file`,
but the condition was wrong and therefore `<input>` was not cleared,
thus keeping same value as before so input was not detected as
changed. A change on this file input is necessary to detect user
interaction file upload.

This commit fixes trigger for clearing the `<input>` of type file,
so that any file upload is properly detected, including uploading
same attachment.

Task-3060429

closes odoo/odoo#105465

X-original-commit: 97f445ae15663486d0100d7127287f9ec3d1d4cc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2022-11-09 17:02:50 +01:00
parent b054a9b9c8
commit 78d2b87a78
@@ -38,13 +38,12 @@ Model({
if (!this.exists()) {
return;
}
if (this.fileInput && this.fileInput.el) {
this.fileInput.el.value = '';
}
if (this.chatterOwner && !this.chatterOwner.hasAttachmentBox) {
this.chatterOwner.openAttachmentBox();
}
this.messaging.messagingBus.trigger('o-file-uploader-upload', { files });
// clear at the end because side-effect of emptying `files`
this.fileInput.value = '';
},
/**
* @private