Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
5268 Visualizzazioni

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
Abbandona
Autore Risposta migliore

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
Abbandona
Risposta migliore

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
set 15
8909
0
ago 15
3085
1
mar 15
4045
2
mar 15
424
1
mar 15
405