I need a little help on Odoo widget. I have this in js file...
_format: function (row_data, options) {
this.session = session;
if (!row_data[this.id] || !row_data[this.id].value) {
return '';
}
var arraygiven = [];
new model('sale.order.line').query(['order_id']).filter([['product_id', '=', row_data[this.id].value]]).all().then(function (records) {
for(var i = 0, len = records.length; i < len; i++){
arraygiven.push(records[i].order_id[1]);
}
//console.log(arraygiven);//arraygiven is shown in console
});
//console.log(arraygiven); //arraygiven is not shown in console
return QWeb.render('producthistorylist', {widget: this, saleorderlinenum: arraygiven});
}
How can i stop further process until i get the value from ajax request i.e. in "arraygiven" in above code? I have to return Qweb.render(....) after the value of arraygiven is received from ajax request?