diff --git a/addons/web/static/src/js/core/qweb.js b/addons/web/static/src/js/core/qweb.js index 50742075e05..253e948d8ac 100644 --- a/addons/web/static/src/js/core/qweb.js +++ b/addons/web/static/src/js/core/qweb.js @@ -5,7 +5,18 @@ var translation = require('web.translation'); var _t = translation._t; -function QWeb(debug, default_dict) { +/** + * @param {boolean} debug + * @param {Object} default_dict + * @param {boolean} [enableTranslation=true] if true (this is the default), + * the rendering will translate all strings that are not marked with + * t-translation=off. This is useful for the kanban view, which uses a + * template which is already translated by the server + */ +function QWeb(debug, default_dict, enableTranslation) { + if (enableTranslation === undefined) { + enableTranslation = true; + } var qweb = new QWeb2.Engine(); qweb.default_dict = _.extend({}, default_dict || {}, { '_' : _, @@ -16,7 +27,7 @@ function QWeb(debug, default_dict) { 'csrf_token': odoo.csrf_token, }); qweb.debug = debug; - qweb.preprocess_node = preprocess_node; + qweb.preprocess_node = enableTranslation ? preprocess_node : function () {}; return qweb; } diff --git a/addons/web/static/src/js/views/kanban/kanban_renderer.js b/addons/web/static/src/js/views/kanban/kanban_renderer.js index 10b412e7739..b40f1b5643c 100644 --- a/addons/web/static/src/js/views/kanban/kanban_renderer.js +++ b/addons/web/static/src/js/views/kanban/kanban_renderer.js @@ -94,7 +94,7 @@ var KanbanRenderer = BasicRenderer.extend({ this._super.apply(this, arguments); this.widgets = []; - this.qweb = new QWeb(session.debug, {_s: session.origin}); + this.qweb = new QWeb(session.debug, {_s: session.origin}, false); var templates = findInNode(this.arch, function (n) { return n.tag === 'templates';}); transformQwebTemplate(templates, state.fields); this.qweb.add_template(utils.json_node_to_xml(templates));