In the class system of the Odoo web framework allows direct modification of existing classes using the include() method.
This system is similar to the inheritance mechanism, except it will alter the target class in-place instead of creating a new class,for example code is like below.
var TestClass = instance.web.Class.extend({
testMethod: function() {
return "hello";
},
});
TestClass.include({
testMethod: function() {
return this._super() + " world";
},
});
console.log(new TestClass().testMethod());
Note-In that case, this._super() will call the original implementation of a method being replaced/redefined.
0 Comment(s)