diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-10-09 11:37:30 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-10-09 11:37:30 +0200 |
| commit | 835b77ba94bd42cd071c8077ff9a86ce977fddab (patch) | |
| tree | b53dfe3553f0cd90681270b0fdd6ae96436bf2ae /addons/web/static/src/js/fields/basic_fields.js | |
| parent | c36dedb0958548d0fe3f83d1d17c223ae26d247a (diff) | |
| parent | ebe43bad9eff9875e7b75f41aa17b90b1d9912a7 (diff) | |
[MERGE] forward port branch 12.0 up to ebe43bad9ef
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 08b6d47f0f5..12b7b8f302c 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -334,7 +334,8 @@ var InputField = DebouncedField.extend({ } if (ev.data.direction ==='next' && this.attrs.modifiersValue && - this.attrs.modifiersValue.required) { + this.attrs.modifiersValue.required && + this.viewType !== 'list') { if (!this.$input.val()){ this.setInvalidClass(); ev.stopPropagation(); @@ -388,7 +389,7 @@ var NumericField = InputField.extend({ * * Note: We have to overwrite this method to set the input's type to number if * option setted into the field. - * + * * @override * @private */ @@ -537,7 +538,7 @@ var FieldDate = InputField.extend({ * @override */ activate: function () { - if (this.datewidget) { + if (this.isFocusable() && this.datewidget) { this.datewidget.focus(); return true; } @@ -1470,12 +1471,19 @@ var FieldBinaryImage = AbstractFieldBinary.extend({ }, }), supportedFieldTypes: ['binary'], + file_type_magic_word: { + '/': 'jpg', + 'R': 'gif', + 'i': 'png', + 'P': 'svg+xml', + }, _render: function () { var self = this; var url = this.placeholder; if (this.value) { if (!utils.is_bin_size(this.value)) { - url = 'data:image/png;base64,' + this.value; + // Use magic-word technique for detecting image type + url = 'data:image/' + (this.file_type_magic_word[this.value[0]] || 'png') + ';base64,' + this.value; } else { url = session.url('/web/image', { model: this.model, |
