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

Hello I would like to inherit JavaScript file gantt.js in web_gantt module.

My code is like that

openerp.mrp_smart_planning = function(instance){
    var module = instance.web_gantt;
    module.GanttView.include({
        init : function(){
            alert('Hello!');
            module._super();
        },
    });
};

(in file named mrp_smart_planning.js)

After reloading webpage, when I want to see gantt view "Hello" alert appear, but after shows windows with text below: Uncaught TypeError: Cannot read property '_model' of undefined

Ảnh đại diện
Huỷ bỏ

What are you trying to achieve.

Tác giả

I want modify gantt view

Tác giả Câu trả lời hay nhất

I found a solution.

openerp.mrp_smart_planning = function(instance){
var module = instance.web_gantt;
module.GanttView.include({
    init : function(view, node){
        alert('Hello!');
        this._super(view, node);
    },
});
};
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Try with this:

openerp.mrp_smart_planning = function(instance){
var module = instance.web_gantt;
module.GanttView=module.GanttView.extend({
    init : function(){
        alert('Hello!');
        this._super();
    },
});

};

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

Unfortunately after applying your code error still appear. T_T

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 9 23
2329
1
thg 8 24
3194
1
thg 5 25
8251
1
thg 11 24
4944
0
thg 5 24
2099