From 11f88c8cd4be39e0b14cd3ecb872b498c8e79b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 23 Jun 2016 09:34:49 +0200 Subject: [PATCH] [FIX] web, web_kanban: make qweb default dict configurable In a previous refactor, qweb configuration was simplified. However, I missed the fact that session.js sneakily configure the qweb instance after the fact. As a result, the kanban view did not have the _s key in its custom qweb instance default dict. This commit allow the qweb class constructor to add default keys to the instance. Now, kanban view can add _s, and everything is good. --- addons/web/static/src/js/framework/qweb.js | 6 +++--- addons/web_kanban/static/src/js/kanban_view.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/framework/qweb.js b/addons/web/static/src/js/framework/qweb.js index 2202460a18a..39066216737 100644 --- a/addons/web/static/src/js/framework/qweb.js +++ b/addons/web/static/src/js/framework/qweb.js @@ -5,16 +5,16 @@ var translation = require('web.translation'); var _t = translation._t; -function QWeb(debug) { +function QWeb(debug, default_dict) { var qweb = new QWeb2.Engine(); - qweb.default_dict = { + qweb.default_dict = _.extend({}, default_dict || {}, { '_' : _, 'JSON': JSON, '_t' : translation._t, '__debug__': debug, 'moment': function(date) { return new moment(date); }, 'csrf_token': odoo.csrf_token, - }; + }); qweb.debug = debug; return qweb; } diff --git a/addons/web_kanban/static/src/js/kanban_view.js b/addons/web_kanban/static/src/js/kanban_view.js index 0f243e20cdf..48cb39ad4cc 100644 --- a/addons/web_kanban/static/src/js/kanban_view.js +++ b/addons/web_kanban/static/src/js/kanban_view.js @@ -60,7 +60,7 @@ var KanbanView = View.extend({ init: function () { this._super.apply(this, arguments); - this.qweb = new QWeb(session.debug); + this.qweb = new QWeb(session.debug, {_s: session.origin}); this.limit = this.options.limit || 40; this.fields = {};