跳至内容
菜单
此问题已终结
1 回复
8508 查看

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
42305
1
6月 23
3517
1
8月 20
8913
2
6月 20
3963
1
9月 18
106