Skip to Content
Menu
This question has been flagged
1 Reply
3225 Views

This code gives me a QWeb Runtime Error when self.my_variable is set too late:

start: function() {

    var self = this;

    var tmp = this._super.apply(this, arguments);

    var defs = [];

    defs.push(my_model.call("my_method", [self.dataset.context]).then(function(result) {

        self.my_variable = result;

    }));

    $.when(tmp, defs).then(function() {

        self.$el.find('.my_class').html(QWeb.render("my_qweb", {pass_to_qweb: self.my_variable}));
    });

    return $.when(tmp, defs);

}

Avatar
Discard
Author Best Answer

The solution was simple:

start: function() {

    var self = this;

    var tmp = this._super.apply(this, arguments);

    var defs = [];

    defs.push(my_model.call("my_method", [self.dataset.context]).then(function(result) {

        self.my_variable = result;

        self.$el.find('.my_class').html(QWeb.render("my_qweb", {pass_to_qweb: self.my_variable}));

    }));

}

Avatar
Discard
Related Posts Replies Views Activity
2
Jul 22
10563
1
Aug 19
3252
0
Feb 17
1932
0
Jun 22
1974
0
Feb 22
1870