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

I have problem with my custom widget. when widget starts, it stays on another product. It needs pager refresh to reload with correct parameters. How to reload automatically my widget when I am changing product form view?


openerp.mymodule = function(instance, local) {    
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;

instance.web.form.widgets.add('mywidget', 'instance.mymodule.WidgetM');
local.WidgetM = instance.web.form.AbstractField.extend({
start: function() {
this.$el.html(QWeb.render("WidgetTemplate"));                
return this._super();            
}
});
}



Thanks

아바타
취소

Hello

Did you manage to solve this problem? I am currently undergoing a similar problem and have been looking for a solution for a while now.

작성자 베스트 답변

Yes I solved this problem:

start: function() {

       this.field_manager.on("load_record", this, function() {

       this._trigger();

});


아바타
취소
베스트 답변

Hi,

As mentioned in my comment I also had this issue.

I was able to solve it using the accepted answer on this stackoverflow thread:

http://stackoverflow.com/questions/40508070/odoo-how-to-reload-widget-on-every-db-record-form-view


I had a start function, in this function I added the lines mentioned in the stackoverflow thread.

And where the thread says 'put your code here' I called my javascript function. This way my method gets triggered on every form change. Do note that when the pager reloads the method gets called twice.

아바타
취소
관련 게시물 답글 화면 활동
2
12월 22
1291
1
2월 25
4221
1
10월 22
11248
0
8월 21
1726
0
6월 21
4550