diff options
| author | Laurent Smet <las@openerp.com> | 2018-08-14 14:55:51 +0200 |
|---|---|---|
| committer | qdp-odoo <qdp@odoo.com> | 2018-08-14 16:40:39 +0200 |
| commit | c99eb1b8fb48eef80300aae90c08b54d28e093a7 (patch) | |
| tree | b82b04197f5e2b0e6e273f68da6cca4e1132e433 /addons/web/static/src/js/fields | |
| parent | 1ab2a4d47d5eaff7811e205468732f43637b39bc (diff) | |
[ADD] account: import vendor bills files from dashboard
This adds a button to import several bills from the accounting dashboard: will create a new vendor bill for each, with the file attached to it. That file will be visible in the chatter (in enterprise) and allow easilly completion/encoding of it. This task also comes along with the import/export of xml files attached to the PDF files created from the invoice report.
Was task 1859277
Was PR #26339
Diffstat (limited to 'addons/web/static/src/js/fields')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index b8eb106caab..692d27e0ca8 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1475,6 +1475,7 @@ var FieldMany2Many = FieldX2Many.extend({ */ var FieldMany2ManyBinaryMultiFiles = AbstractField.extend({ template: "FieldBinaryFileUploader", + template_files: "FieldBinaryFileUploader.files", supportedFieldTypes: ['many2many'], fieldsToFetch: { name: {type: 'char'}, @@ -1549,7 +1550,7 @@ var FieldMany2ManyBinaryMultiFiles = AbstractField.extend({ // _setValue, we put the rendering here to ensure they will be updated this._generatedMetadata(); this.$('.oe_placeholder_files, .oe_attachments') - .replaceWith($(qweb.render('FieldBinaryFileUploader.files', { + .replaceWith($(qweb.render(this.template_files, { widget: this, }))); this.$('.oe_fileupload').show(); @@ -1611,6 +1612,10 @@ var FieldMany2ManyBinaryMultiFiles = AbstractField.extend({ var files = ev.target.files; var attachment_ids = this.value.res_ids; + // Don't create an attachment if the upload window is cancelled. + if(files.length == 0) + return; + _.each(files, function (file) { var record = _.find(self.value.data, function (attachment) { return attachment.data.name === file.name; |
