Odoo Help

0

How to override web_calendar JS

By
Shawn Varghese
on 3/16/15, 1:54 AM 1,426 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"); ......  }

}

0
Vasanth
On 3/17/15, 2:18 AM

Hi, try this

openerp.my_web_calendar=function(instance){ 

instance.web_calendar.include({ 

get_fc_defaultOptions : function(){ 

this._super.apply(this, arguments);

}

});

}

0

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.

}

}

}

0
Shawn Varghese
On 3/16/15, 5:40 AM

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.

 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 3/16/15, 1:54 AM
Seen: 1426 times
Last updated: 3/17/15, 2:18 AM