Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion dms/static/src/js/views/dms_file_upload.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,15 @@ export function createFileUploadExtension() {
throw new Error(attachments.error);
}

await this.onUpload(attachments);
await this.onUpload(attachments).finally(() => {
// Delete the attachments once we're done with them
const attachmentIds = attachments.map((a) => a.id);
// If the upload failed, don't waste an unlink call
if (!attachmentIds.length) {
return;
}
this.orm.call("ir.attachment", "unlink", [attachmentIds]);
});
},

async onUpload(attachments) {
Expand Down
Loading