콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
5301 화면

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
8965
0
8월 15
3116
1
3월 15
4089
2
3월 15
472
1
3월 15
457