Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
8519 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
cze 23
42323
1
cze 23
3523
1
sie 20
8920
2
cze 20
3974
1
wrz 18
106