diff options
| author | Jeremy Kersten <jke@odoo.com> | 2018-06-14 15:49:00 +0200 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2018-06-15 12:12:26 +0200 |
| commit | d702e82b9caa17b0410a13889e2352c3fc6425f5 (patch) | |
| tree | c0d2ee70c1097166e65d2ba25caeb582c7612613 /addons/web/static/src/js/fields | |
| parent | c4f5b9f751005cc7e50bf957f113d229570a92c1 (diff) | |
[FIX] web: fix ace editor when value is False
Avoid to crash the client web with setValue(false).
false.match, false.split, false.length... will not works.
Before this commit, _render call the setValue after comparing '' !== false
Diffstat (limited to 'addons/web/static/src/js/fields')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index ba4169d2617..4e083d3f0c8 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -2432,6 +2432,21 @@ var AceEditor = DebouncedField.extend({ //-------------------------------------------------------------------------- /** + * Format value + * + * Note: We have to overwrite this method to always return a string. + * AceEditor works with string and not boolean value. + * + * @override + * @private + * @param {boolean|string} value + * @returns {string} + */ + _formatValue: function (value) { + return this._super.apply(this, arguments) || ''; + }, + + /** * @override * @private */ @@ -2453,6 +2468,7 @@ var AceEditor = DebouncedField.extend({ this.aceSession.setValue(newValue); } }, + /** * Starts the ace library on the given DOM element. This initializes the * ace editor option according to the edit/readonly mode and binds ace |
