Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
4972 Lượt xem

(Odoo 10, 11 or 12) Hi Guys, I need to reload a Kanban view every so often. Is it possible to reload a specific Kanban record? When I call the update event it gives me a CORS error. I'm afraid I should call another function but I don't know the name.

-- Edited

I have managed to reload the contents of all the records of a Kanban view although my goal was to reload a single item of that Kanban view, since they have different periodicity.


odoo.define('kpis.Record', function (require) {
"use strict";

var KanbanRecord = require('web_kanban.KanbanView');
var Model = require('web.DataModel');

KanbanRecord.include({
intervalCron: 0,
start: function () {
var self = this;
var result = this._super();
if (this.model == 'kpi') {
self.intervalCron = setInterval(function () {
self.refresh(self)
}, 5000);
} else {
clearInterval(this.intervalCron);
}
return result;
},
refresh: function (widget) {
if (this.model == 'kpi') {
widget.do_reload();
} else {
clearInterval(widget.intervalCron);
}
},
destroy: function()
{
clearInterval(this.intervalCron);
this._super();
}
});
Ảnh đại diện
Huỷ bỏ

Hi @Fernando,

I don't find the module web_kanban , so my function doesn't have the function do_reload().

Where do I find that module ?

Câu trả lời hay nhất

Hello Fernando,

Are you trying to reload the kanban view,

Try to return the same window action of that kanban view from your python function.

Like this.

Eg:

action = self.env.ref('module.id_of_window_action').read()[0]
return action

Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks for the reply. It turns out that I explained myself badly. I mean the client side, not the server. I edit the question to clarify it.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 6 21
4476
2
thg 3 16
5540
2
thg 7 23
2728
1
thg 4 16
5133
0
thg 3 15
4895