Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
5331 มุมมอง

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 15
8986
0
ส.ค. 15
3122
1
มี.ค. 15
4122
2
มี.ค. 15
479
1
มี.ค. 15
467