Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 498
Developer Marius Žilėnas Avatar asked Apr 18 '18 04:04

Developer Marius Žilėnas


1 Answers

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. 😉

like image 147
Yajo Avatar answered Sep 20 '22 10:09

Yajo