Odoo difference in Javascript extend and include

In Odoo one can extend or include on a class (in Javascript). What is the difference in Odoo between extend and include?

Upvotes: 7

Views: 8091

Answers (1)

Yajo
Yajo

Reputation: 6428

When you extend, instances from the parent class remain untouched, but instances from the new child class will have the extended features.

OTOH, when you include, you are adding the new features to the prototype of the parent class, which means that automatically all instances of such class include the extended behavior.


You know, JS works with prototypes; i wrote about class and instance just to make it easier to understand. 😉

Upvotes: 23

Related Questions