I have this piece of code:
new instance.web.Model('hr.employee').query(["week_busyness"]).filter([["id", "=", employee_id]]).first().then(function(result){
return result.week_busyness;
});
It returns field I need, but I can only use it inside that defined function. But I need that field to be used outside function. I just can't seem to understand how to do that..
For example if I assign it to variable like:
test = new instance.web.Model('hr.employee').query(["week_busyness"]).filter([["id", "=", employee_id]]).first().then(function(result){
return result.week_busyness;
and then:
console.log(test)
it prints function object, not the 'result.week_busyness'. How could I get instead that value?
can you post your console.log(test) output ?...
or give me the output alert("myObject is " + test.toSource());
output is this: Object {state: function, always: function, then: function, promise: function, pipe: function…}
and I can't output with toSource(). It gives this error then - Uncaught TypeError: undefined is not a function
Andrius, Why don't you define a global variable at the top, and then assign your result to that variable. then you can use it anywhere.... "even outside of the scope of function too"