diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-01-03 12:28:52 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-01-03 12:28:52 +0100 |
| commit | 362f0489d07d5bcd3673278e93848d0ea3d177a8 (patch) | |
| tree | ce164613ca633d736bf41c5b3d02b8ee541baa89 /addons/web/static/src/js/fields | |
| parent | a39491d459f7a70af21bce1f45434bab05f1c284 (diff) | |
| parent | fe22a0f9ca92ef0e76bb2f730a2b22da500db5dd (diff) | |
[MERGE] forward port branch 11.0 up to fe22a0f9ca9
Diffstat (limited to 'addons/web/static/src/js/fields')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 4 | ||||
| -rw-r--r-- | addons/web/static/src/js/fields/field_utils.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 19 |
3 files changed, 12 insertions, 13 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index de5f80b0e92..eb56844de14 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -576,8 +576,8 @@ var FieldMonetary = InputField.extend({ this.tagName = 'div'; this.className += ' o_input'; - // use the formatFloat function in edit - this.formatType = 'float'; + // do not display currency symbol in edit + this.formatOptions.noSymbol = true; } this.formatOptions.currency = this.currency; diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/js/fields/field_utils.js index bca74acc088..932ea997e6a 100644 --- a/addons/web/static/src/js/fields/field_utils.js +++ b/addons/web/static/src/js/fields/field_utils.js @@ -290,7 +290,7 @@ function formatMonetary(value, field, options) { digits: (currency && currency.digits) || options.digits, }); - if (!currency) { + if (!currency || options.noSymbol) { return formatted_value; } if (currency.position === "after") { diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 1c4c072726b..c4697cdafe1 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -824,12 +824,9 @@ var FieldX2Many = AbstractField.extend({ return this._super(); } if (this.renderer) { - this.renderer.updateState(this.value, {}); this.currentColInvisibleFields = this._evalColumnInvisibleFields(); - this.pager.updateState({ - size: this.value.count, - columnInvisibleFields: this.currentColInvisibleFields, - }); + this.renderer.updateState(this.value, {'columnInvisibleFields': this.currentColInvisibleFields}); + this.pager.updateState({ size: this.value.count }); return $.when(); } var arch = this.view.arch; @@ -839,7 +836,7 @@ var FieldX2Many = AbstractField.extend({ this.currentColInvisibleFields = this._evalColumnInvisibleFields(); this.renderer = new ListRenderer(this, this.value, { arch: arch, - mode: this.mode, + editable: this.mode === 'edit' && arch.attrs.editable, addCreateLine: !this.isReadonly && this.activeActions.create, addTrashIcon: !this.isReadonly && this.activeActions.delete, viewType: viewType, @@ -1380,12 +1377,12 @@ var FieldMany2ManyBinaryMultiFiles = AbstractField.extend({ throw _.str.sprintf(msg, this.field.string); } + this.uploadedFiles = {}; this.uploadingFiles = []; this.fileupload_id = _.uniqueId('oe_fileupload_temp'); $(window).on(this.fileupload_id, this._onFileLoaded.bind(this)); this.metadata = {}; - this._generatedMetadata(); }, destroy: function () { @@ -1415,10 +1412,10 @@ var FieldMany2ManyBinaryMultiFiles = AbstractField.extend({ _generatedMetadata: function () { var self = this; _.each(this.value.data, function (record) { - // attachments are tagged `allowUnlink` because only new attachments - // will be unlinked after deletion + // tagging `allowUnlink` ascertains if the attachment was user + // uploaded or was an existing or system generated attachment self.metadata[record.id] = { - allowUnlink: false, + allowUnlink: self.uploadedFiles[record.data.id] || false, url: self._getFileUrl(record.data), }; }); @@ -1430,6 +1427,7 @@ var FieldMany2ManyBinaryMultiFiles = AbstractField.extend({ _render: function () { // render the attachments ; as the attachments will changes after each // _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', { widget: this, @@ -1537,6 +1535,7 @@ var FieldMany2ManyBinaryMultiFiles = AbstractField.extend({ self.do_warn(_t('Uploading Error'), file.error); } else { attachment_ids.push(file.id); + self.uploadedFiles[file.id] = true; } }); |
