Skip to Content
Menú
This question has been flagged
1 Respondre
8482 Vistes

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
Descartar
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
Descartar
Related Posts Respostes Vistes Activitat
2
de juny 23
42251
1
de juny 23
3465
1
d’ag. 20
8876
2
de juny 20
3931
1
de set. 18
106