跳至內容
選單
此問題已被標幟
2 回覆
5086 瀏覽次數

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?


頭像
捨棄
作者 最佳答案

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.

頭像
捨棄
最佳答案

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
9月 15
8696
0
8月 15
2923
1
3月 15
3871
1
3月 15
242
2
3月 15
296