summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2017-02-15 15:59:04 +0100
committerNicolas Lempereur <nle@odoo.com>2017-02-23 16:52:45 +0100
commit65c1926a37586c811d1fbbf4b855cda0f2348986 (patch)
tree3b56f610b90226d3a30486d7550c3a90911c0842 /addons/web_editor/static/src
parentf3491a27a594e2ea3503c6210242cf80b22c6db0 (diff)
[FIX] web: html_frame field and lang vs onchange
In mass mailing there is several possibilities of states when rendering the widget with a possibly new value: 1. we are not in edition a. we are in same language than user language => the editor content can be updated b. we are in a different language => the content cannot be updated 2. we are in edition a. we are editing translation : the editor content cannot be updated b. we are not editing translation (editor language == en_US) i. we are requesting editor update (by having magic value `on_change_model_and_list`) => the editor can be updated ii. we are in same language than user language => the editor content can be updated iii. we are in a different language => the editor content cannot be updated In summary: - if language is the same than the user, we can update the value - if value is magic `on_change_model_and_list` and we are not translating, we can update the editor Before this commit, this worked as expected but for 2.a.ii. which if the user language was not en_US would for example prevent editor updating. closes #15583 closes #15414 opw-708032 inspired by a27e24c6d1 note: the fix is a fix for 9.0 and saas-11 only.
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/backend.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js
index 534ee1bc677..025a09f3d83 100644
--- a/addons/web_editor/static/src/js/backend.js
+++ b/addons/web_editor/static/src/js/backend.js
@@ -351,7 +351,12 @@ var FieldTextHtml = widget.extend({
});
},
render_value: function() {
- if (this.lang !== this.view.dataset.context.lang || this.$iframe.attr('src').match(/[?&]edit_translations=1/)) {
+ if (this.$iframe.attr('src').match(/[?&]edit_translations=1/)) {
+ return;
+ }
+ // ONLY HAVE THIS IN 9.0 AND SAAS-11
+ var is_editor_onchange = this.get('value') === '<p>on_change_model_and_list</p>';
+ if (this.lang !== this.view.dataset.context.lang && !is_editor_onchange) {
return;
}
var value = (this.get('value') || "").replace(/^<p[^>]*>(\s*|<br\/?>)<\/p>$/, '');