Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
5156 Weergaven

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?


Avatar
Annuleer
Auteur Beste antwoord

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.

Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
sep. 15
8731
0
aug. 15
2965
1
mrt. 15
3884
1
mrt. 15
278
2
mrt. 15
324