In Odoo one can extend
or include
on a class (in Javascript). What is the difference in Odoo between 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
?
1 Answer
Reset to default 23When 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.