summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/backend.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-05-29 10:12:43 +0200
committerGéry Debongnie <ged@odoo.com>2017-05-29 12:12:44 +0200
commitcad943d035c200cce4a7e5a428d2883bf2452b9d (patch)
tree3913accbc9afacc52b8fe67cc05dd24bd4faf424 /addons/web_editor/static/src/js/backend.js
parentd76dc17a980a05661c9c15c89785b7485482805d (diff)
[FIX] web_editor: prevent crash with FieldTextHtmlSimple
If the method commitChange from the widget FieldTextHtmlSimple was called in mode=readonly, a traceback was displayed. This is not very common, because most save operations are done in mode=edit, but it can happen in readonly mode: when the user clicks on an action button, then the form view is saved, if necessary. To reproduce this bug, just open a form view for res.users, and click on the Change Password button.
Diffstat (limited to 'addons/web_editor/static/src/js/backend.js')
-rw-r--r--addons/web_editor/static/src/js/backend.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js
index 8895ee0b99a..c12ab41b4bb 100644
--- a/addons/web_editor/static/src/js/backend.js
+++ b/addons/web_editor/static/src/js/backend.js
@@ -39,7 +39,7 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend({
*/
commitChanges: function () {
// switch to WYSIWYG mode if currently in code mode to get all changes
- if (config.debug) {
+ if (config.debug && this.mode === 'edit') {
var layoutInfo = this.$textarea.data('layoutInfo');
$.summernote.pluginEvents.codeview(undefined, undefined, layoutInfo, false);
}