Skip to Content
Menu
This question has been flagged
1 Atsakyti
8653 Rodiniai

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.

Portretas
Atmesti
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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
2
birž. 23
42519
1
birž. 23
3644
1
rugp. 20
9067
2
birž. 20
4111
1
rugs. 18
106