HI, i'm looking for a way to extend POS using model.js
I have wroted this function inside Order.extend
get_tiquete_hacienda: function (){
var rpc2 = require('web.rpc');
rpc2.query({
model: 'pos.order',
method: 'compute_sales_bsi'
}).then(function(res) {
this.consecutivo = res;
console.log('soy el otro: ' + res);
});
return this.consecutivo;
}
When creating a new order, if a look at the console the value "soy el otro" shows the data but the variable "consecutivo" inside order data shows "undefined"
What i'm doing wrong?