Odoo Help


Javascript: getting the value out of a "resolve"

Rui Franco
on 2/28/15, 1:16 PM 746 views

I'm trying to query a database from inside a function and, then, use the values I get. However, although the query is performed appropriately and the values are correct, I am not able to return them.

Does anyone know how to fix the code below? :|

function get_coordinates(coords_id){
                var def = new $.Deferred();
                new instance.web.Model("gps_base.coords")
                    .filter([["id", "=", coords_id]])
                    .then(function(result) {
                        if(!result || result.length === 0){
                            //this works!
                //this is "just" Object...
                return def;

On 3/1/15, 5:02 AM

Try to change this:

var def = new $.Deferred();

return def;

to this:

var def = $.Deferred();

return def.promise();

Thanks, but it did no good.

Rui Franco
on 3/1/15, 2:40 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 2/28/15, 1:16 PM
Seen: 746 times
Last updated: 3/16/15, 8:10 AM