Odoo Help


Backend javascript - how transfer current id of form object to script?

on 6/19/15, 2:20 PM 2,320 views

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?



| 6 4 7
Lodz, Poland

On 6/20/15, 5:51 AM

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> 


openerp.my_module = function(instance) {

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

button_clicked: function(ev) {

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...



Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 6/19/15, 2:20 PM
Seen: 2320 times
Last updated: 6/20/15, 8:48 AM