Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use instantiate classes using the new operator in OpenERP/Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 160
    Comment on it

    If you want to instantiate classes 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({
        say_hello: function() {
            console.log("hello", this.name);
        },
    });
    
    var my_object = new MyClass();
    my_object.name = "Bob";
    my_object.say_hello();
    // print "hello Bob" in the console

    Note- And attributes of the instance can be accessed above code.

 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: