Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Subclassing Widget in Odoo

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 186
    Comment on it

    Subclassing widget is most important for Odoo.With the help of subclassing Widget() we can change the standard manner with the extend() method, and provides a number of abstract properties and concrete methods .Subclassing Widget looks like this:

    var MyWidget = Widget.extend({
        // QWeb template to use when rendering the object
        template: "MyQWebTemplate",
        events: {
            // events binding example
            'click .my-button': 'handle_click',
        },
    
        init: function(parent) {
            this._super(parent);
            // insert code to execute before rendering, for object
            // initialization
        },
        start: function() {
            var sup = this._super();
            // post-rendering initialization code, at this point
    
            // allows multiplexing deferred objects
            return $.when(
                // propagate asynchronous signal from parent class
                sup,
                // return own's asynchronous signal
                this.rpc(/*  */))
        }
    });
    

    Note-you will have to first call render() on the widget, then insert it into your Subclassing Widget and start it.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: