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

How to get field value from python to javascript ?

Avatar
Discard
Best Answer

You may try like this in your javascript function, a simple example to fetch email of a partner:

        var model = new instance.web.Model("res.partner");
        model.query(["email"])
             .filter([['name', '=', 'MouBou']])
             .limit(1)
             .then(function(result) { self.$el.append("<div> Your email id is " + result.email + "</div>");
      });

You may use model.query() to combine search & read from your python models based on conditions or you may use model.call() to call any python methods defined in your model. 

Avatar
Discard