Inheritance means we are going to use or inherit old class/model, properties, methods, and views in the new class/model. This concept is related to Object Oriented Programming.
1 of 7
More Related Content
Inheritance _ Traditional Class Inheritance in Odoo 16
2. ● Inheritance means we are going to use or inherit old
class/model, properties, methods, and views in the new
class/model. This concept is related to Object Oriented
Programming. In Odoo/ERP we extend properties, fields, and
views of an existing model in a modular way. Here we are
going to learn about traditional class inheritance. This is used
to extend the features of an existing object.
3. • For inheriting existing class we use the keyword ‘_inherit’ . That is,
_inherit = model name , and here this is python file named as ‘sale_order.py’
4. • This is an existing model, which is ‘sale.order’ and into this model we have inherited to a new
class and used the inherited keyword inherit the existing model and also define a new field
here ‘is_version’ , So that, this field will be added into the database or the table of this existing
model.
5. • Now , we have to inherit this field in the views. The view file is look like below,
6. • Put the name as ‘sale_order_view.xml’ in the view file; also add this view in the
‘__manifest__.py’ file.
7. Check our company website
for related blogs and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.