Skip to Content
Menu
This question has been flagged
1 Odpoveď
8642 Zobrazenia

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
Zrušiť
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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
2
jún 23
42510
1
jún 23
3642
1
aug 20
9054
2
jún 20
4104
1
sep 18
106