跳至內容
選單
此問題已被標幟
1 回覆
18406 瀏覽次數

Question related to my previous

I want to get the id (and model) of the form in the backend javascript function (event click). How to get this?

頭像
捨棄
作者 最佳答案

Full example how to get, in javascript, field_values array, model, ids and id in backend form:

inherited XML:

<div id="target">Click here</div> 

Javascript:

openerp.my_module = function(instance) {

instance.web.FormView = instance.web.FormView.extend({
events: {
'click #target button': 'button_clicked',
},

button_clicked: function(ev) {
ev.preventDefault();
ev.stopPropagation();

var field_values = this.get_fields_values();
var ids = this.get_selected_ids();
var id = field_values['id']
var model = this.model

openerp.jsonRpc('/my_module/example/, 'call', { model: model, ids: ids, id: id}).then(function (data) {
...my code...
});

},
});

}

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
12月 22
2497
1
2月 18
6312
0
12月 21
3905
0
6月 25
409
1
6月 25
673