Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use initializer receives the parameters passed when using the new operator OpenERP/Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 157
    Comment on it

    If you use to initializer receives the parameters passed when using the new operator in OpenERP(Odoo) follow the below mentioned code and paste it in your .js file.

    var MyClass = instance.web.Class.extend({
        init: function(name) {
            this.name = name;
        },
        say_hello: function() {
            console.log("hello", this.name);
        },
    });
    
    var my_object = new MyClass("Bob");
    my_object.say_hello();
    

    Note-It is also possible to create subclasses from existing classes by calling extend() on the parent class, as is done to subclass Class().

 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: