diff options
| author | Alexandre Kühn <aku@odoo.com> | 2021-03-26 13:52:21 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2021-03-26 15:10:55 +0000 |
| commit | 065f3b850d4b1981f02bef60bbfed083b6c4bc7b (patch) | |
| tree | bd503c67e8e25cc732178e296c4ef8e00800eda2 /addons/mail/static | |
| parent | 2208a9b5e18881f5fbfea56872990daafba45579 (diff) | |
[FIX] mail: no traceback on uploading attachment
Task-2486731
closes odoo/odoo#68405
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Diffstat (limited to 'addons/mail/static')
| -rw-r--r-- | addons/mail/static/src/components/file_uploader/file_uploader.js | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/addons/mail/static/src/components/file_uploader/file_uploader.js b/addons/mail/static/src/components/file_uploader/file_uploader.js index 74678d74ec1..4e57eadd19d 100644 --- a/addons/mail/static/src/components/file_uploader/file_uploader.js +++ b/addons/mail/static/src/components/file_uploader/file_uploader.js @@ -58,11 +58,12 @@ class FileUploader extends Component { //-------------------------------------------------------------------------- /** + * @deprecated * @private * @param {Object} fileData * @returns {mail.attachment} */ - _createAttachment(fileData) { + _createAttachment(fileData) { return this.env.models['mail.attachment'].create(Object.assign( {}, fileData, @@ -91,11 +92,16 @@ class FileUploader extends Component { */ _createTemporaryAttachments(files) { for (const file of files) { - this._createAttachment({ - filename: file.name, - isTemporary: true, - name: file.name - }); + this.env.models['mail.attachment'].create( + Object.assign( + { + filename: file.name, + isTemporary: true, + name: file.name + }, + this.props.newAttachmentExtraData + ), + ); } } /** @@ -180,13 +186,18 @@ class FileUploader extends Component { // Without this the useStore selector of component could be not called // E.g. in attachment_box_tests.js await new Promise(resolve => setTimeout(resolve)); - const attachment = this._createAttachment({ - filename, - id, - mimetype, - name, - size, - }); + const attachment = this.env.models['mail.attachment'].insert( + Object.assign( + { + filename, + id, + mimetype, + name, + size, + }, + this.props.newAttachmentExtraData + ), + ); this.trigger('o-attachment-created', { attachment }); } } |
