This question has been flagged
3 Replies
5223 Views

The web_calendar/static/src/js/web_calendar.js file defines a function in the following manner:

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

    function get_class(name) {
        return new instance.web.Registry({'tmp' : name}).get_object("tmp");
    }

    function get_fc_defaultOptions() { ...}

I want to extend the function get_fc_defaultOptions() . Can anyone help me with the JS definition to extend this? The code that I am trying looks like this, but it does not seem to get invoked:

openerp.my_web_calendar=function(instance){
    
    var _t = instance.web._t,
    _lt = instance.web._lt;
    var QWeb = instance.web.qweb;
    
    instance.my_web_calendar={};
    
    function get_fc_defaultOptions() {
        console.log("here"); ......  }

}

Avatar
Discard
Best Answer

Hi, try this

openerp.my_web_calendar=function(instance){ 

instance.web_calendar.include({ 

get_fc_defaultOptions : function(){ 

this._super.apply(this, arguments);

}

});

}

Avatar
Discard
Best Answer

Hi,

You can manage your extension as like below.

openerp.my_web_calendar=function(instance){

instance.web_calendar.include({

get_fc_defaultOptions : function(){

// Your code for extenstion.

}

}

}

Avatar
Discard
Author Best Answer

Thanks Emipro Technologies, but I had already tried this, and got the following error:

Uncaught TypeError: undefined is not a function

It seems that I instance.web_calendar does not have an include property. I would have to extend one the classes within in, such as CalendarView etc., but that would not be applicable in this case.

Please let me know in case you have any other suggestions.

 

Avatar
Discard