Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
18318 Weergaven

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?

Avatar
Annuleer
Auteur Beste antwoord

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...
});

},
});

}

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
dec. 22
2385
1
feb. 18
6215
0
dec. 21
3805
1
jun. 25
461
1
jun. 25
395