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

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

อวตาร
ละทิ้ง

What are you trying to achieve.

ผู้เขียน

I want modify gantt view

ผู้เขียน คำตอบที่ดีที่สุด

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);
    },
});
};
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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();
    },
});

};

อวตาร
ละทิ้ง
ผู้เขียน

Unfortunately after applying your code error still appear. T_T

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ย. 23
2317
1
ส.ค. 24
3190
how to read field values using js แก้ไขแล้ว
1
พ.ค. 25
8246
1
พ.ย. 24
4934
0
พ.ค. 24
2094