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)