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

How to get classes or objects or records of openerp from javascript?

By
Drees Far
on 8/19/15, 9:29 AM 532 views

I am working on a new widget with static folder in openERP.

But now i want to get a class and access to its attributes or even some records.

Who knows how please?


0

Drees Far

--Drees Far--
1130
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 8/20/15, 5:05 AM

Friends!!!!

I have found the answer by my self:

var model = new instance.web.Model("model_name");

Here you can get your model then you can do whatever you want on it such as this example:


instance.oepetstore.HomePage = instance.web.Widget.extend({

start: function() {

var self = this;

var model = new instance.web.Model("message_of_the_day");

model.call("my_method", [], {context: new

instance.web.CompoundContext()}).then(function(result) {

self.$el.append("<div>Hello " + result["hello"] + "</div>");

// will show "Hello world" to the user

});

},

});

Regards.

0

Temur

--Temur--
2896
| 6 5 7
Tbilisi, Georgia
--Temur--
Programmer
Temur
On 8/20/15, 3:58 AM

you can try to call browse or search ORM methods(see doc) using RPC (see answer here), as any other method you like.

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: 8/19/15, 9:29 AM
Seen: 532 times
Last updated: 8/20/15, 5:05 AM