コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
8641 ビュー

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.

アバター
破棄
最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
2
6月 23
42510
1
6月 23
3642
1
8月 20
9054
2
6月 20
4104
1
9月 18
106