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

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
widget many2many_list not working v13 แก้ไขแล้ว
2
ธ.ค. 22
1291
1
ก.พ. 25
4071
publicWidget.Widget.extend example แก้ไขแล้ว
1
ต.ค. 22
10919
0
ส.ค. 21
1666
0
มิ.ย. 21
4447