[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.
This commit is contained in:
Géry Debongnie
2016-06-23 09:34:49 +02:00
parent bb7f933818
commit 11f88c8cd4
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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;
}
@@ -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 = {};