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

I am trying to display field values when button is clicked. This button is not linked to any module.It is in the navigation bar just beside the conversations. How can i get the field values from a particular module on button click.

Avatar
Discard
Best Answer

Your JS code should look like this:

var model = require('web.DataModel');

$('#my-button').click(function() {
     new Model('addon.model').query(['name'])
.filter([['id', '=', 1]])
.first()
.then(function(res) {
      console.log(res);
});
}); 

Check out the docs for more info: https://www.odoo.com/documentation/10.0/reference/javascript.html#high-level-api-calling-into-odoo-models

Avatar
Discard
Related Posts Replies Views Activity
2
Jun 23
40685
1
Jun 23
2263
1
Aug 20
7678
2
Jun 20
2892
1
Sep 18
106