콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
18617 화면

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
2803
1
2월 18
6498
0
12월 21
4135
0
7월 25
396
1
7월 25
5274