Odoo Help

Welcome!

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

0

Call write method in javascript

By
james_p
on 9/11/15, 5:05 AM 899 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()})
2
Jo
On 9/11/15, 5:16 AM

James try this

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

2

Parikshit

--Parikshit--
939
| 6 3 8
Ahmedabad, India
--Parikshit--

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

Parikshit
On 9/14/15, 2:47 AM

Hello,

For this Please do like this :

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

Hope this will help you..

0
james_p
On 9/11/15, 5:27 AM

Im getting this error when i do that:


assert isinstance(record_id, (int, long))
AssertionErrorAssertionError

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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