Odoo Help


Call write method in javascript

on 9/11/15, 5:05 AM 983 views

Hi guys,

Stuck here for quite a few hours now. Anyone who can share what's the correct syntax to call the write method in javascript? So far, I have below code that doesnt work. Thanks !

var model = new instance.web.Model("my.product");
var values = [{'name' : "james"}];
var id = 1;
model.call('write', [[id], values]],  {context: new instance.web.CompoundContext()})
On 9/11/15, 5:16 AM

James try this

model.call("write", [[id], {'name': "james"}])



| 6 3 8
Ahmedabad, India

Working as an OpenERP/Odoo developer both experience in web and addons. you can contact me at:

E-mail : parikshitvaghasiya@gmail.com

Blog : parikshitvaghasiya.blogspot.in

Stackoverflow : http://stackoverflow.com/users/5089106/parikshit-vaghasiya

On 9/14/15, 2:47 AM


For this Please do like this :

new instance.web.Model('crm.lead').call('write', [[val]], {})
console.log("main resultttttttttttt", result); 

Hope this will help you..

On 9/11/15, 5:27 AM

Im getting this error when i do that:

assert isinstance(record_id, (int, long))

The my.product model has only 2 fields: id and name. Im assuming that (int, long) refers to those 2 fields. I've tried lots of combinations of (, {, [ but nothing seems to work.

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

1 follower(s)


Asked: 9/11/15, 5:05 AM
Seen: 983 times
Last updated: 9/14/15, 2:53 AM