diff options
| author | qsm-odoo <qsm@odoo.com> | 2019-03-04 13:06:09 +0100 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2019-03-04 17:05:01 +0100 |
| commit | fdb9f8273be62d0a6d8051f7ca0a66cdf22ae5e7 (patch) | |
| tree | 51c318301c3825526ed339e34d52bb2e0a03b30c | |
| parent | 232da9a0ecee1325b2a20d9655461286741ebbee (diff) | |
[FIX] web_editor: stop using translated versions in HTML editor
Since https://github.com/odoo/odoo/commit/5a030db3eb77b6d80187f8ae1a64303b2f50391d
the HTML editor displayed the translated versions of the templates it
allows to customize. So if the user edited and saved such a template,
the non-translated version was saved with translated-version content.
The behavior before the mentioned commit was:
1) Load all views the HTML editor allows to edit
2) Each time a view is displayed, re-make a RPC to load the view again
The mentioned commit made this simpler by making:
1) Load all views the HTML editor allows to edit
2) Each time a view is displayed, simply show the previously loaded view
... the problem was that the step (2) of the old behavior was
explicitly saying (client-side) to load the view's untranslated content.
This commit makes step (1) always load the untranslated versions of the
views (server-side).
| -rw-r--r-- | addons/web_editor/models/ir_ui_view.py | 3 | ||||
| -rw-r--r-- | addons/website/static/src/js/website.tour.rte.js | 20 |
2 files changed, 22 insertions, 1 deletions
diff --git a/addons/web_editor/models/ir_ui_view.py b/addons/web_editor/models/ir_ui_view.py index 3aa6bac4713..808297f7702 100644 --- a/addons/web_editor/models/ir_ui_view.py +++ b/addons/web_editor/models/ir_ui_view.py @@ -188,7 +188,8 @@ class IrUiView(models.Model): ``bundles=True`` returns also the asset bundles """ user_groups = set(self.env.user.groups_id) - views = self.with_context(active_test=False)._views_get(key, bundles=bundles) + View = self.with_context(active_test=False, lang=None) + views = View._views_get(key, bundles=bundles) views = views.filtered(lambda v: not v.groups_id or len(user_groups.intersection(v.groups_id))) return views diff --git a/addons/website/static/src/js/website.tour.rte.js b/addons/website/static/src/js/website.tour.rte.js index 7785441faa0..d4ddff476e7 100644 --- a/addons/website/static/src/js/website.tour.rte.js +++ b/addons/website/static/src/js/website.tour.rte.js @@ -151,6 +151,26 @@ tour.register('rte_translator', { }, { content: "check bis: placeholder translation", trigger: 'input[placeholder="test french placeholder"]', + }, { + content: "Open customize menu", + trigger: "#customize-menu > .dropdown-toggle", + }, { + content: "Open HTML editor", + trigger: "[data-action='ace']", + }, { + content: "Check that the editor is not showing translated content (1)", + trigger: '.ace_text-layer .ace_line:contains("an HTML")', + run: function (actions) { + var lineEscapedText = $(this.$anchor.text()).text(); + if (lineEscapedText !== "<b></b> is an HTML tag & is empty") { + console.error('The HTML editor should display the correct untranslated content'); + $('body').addClass('rte_translator_error'); + } + }, + }, { + content: "Check that the editor is not showing translated content (2)", + trigger: 'body:not(.rte_translator_error)', + run: function () {}, }, ] ); |
