SlideShare a Scribd company logo
2
Most read
10
Most read
13
Most read
Different types of inheritance
in odoo 18
Enterprise
Enterprise
In Odoo 18, inheritance enables seamless customization of
modules, from data models and views to methods and
interfaces. This slide outlines the different types of inheritance
techniques for extending functionality effectively.
Introduction
Enterprise
The two types of inheritance in Odoo are,
1- Model Inheritance
2- View Inheritance
Types of Inheritance
Enterprise
Odoo offers three main types of model inheritance:
1) Delegation
2) Extension
3) Classical inheritance.
Model Inheritance
Enterprise
Enterprise
In Odoo, when both the `_inherit` and `_name` attributes are
used together, the new model builds upon the existing model
specified by `_inherit`. This allows the new model to inherit all
the fields, methods, and metadata (such as defaults) from the
base model.
Classical Inheritance
Enterprise
Enterprise
In the code above, two classes are defined: a parent class and a
child class.
The parent class only specifies the `_name` attribute, while the
child class defines both `_name` and `_inherit`. This allows the
child model to inherit the fields and functions of the parent
class.
Let’s now see how this works in practice:
Explanation
Enterprise
In this way, the child model can access the data, fields, and
functions of the parent model.
Enterprise
When using the extension form of inheritance, only the _inherit
attribute is needed, without the _name attribute. This replaces
the original model with the new one, while allowing us to add
more fields or functionalities to the existing model. Below is an
example of how to implement extended inheritance:
Extension
Enterprise
Enterprise
When we inspect the database, we can see that the field
`description` has been added to the model
`extension.extension`.
We use the _inherits attribute for delegation inheritance. This
type of inheritance allows you to link another model to your
current model without altering the views. As a result, the
database tables will contain both a field for the inherited object
and the data from your model.
Below is an example of how to implement delegation
inheritance:
Delegation
Enterprise
Enterprise
In Odoo, we can observe that the product template contains
several `many2one` fields in the product model. Odoo
provides multiple examples of this setup. These fields are
stored exclusively in the product template table, although the
product model can access and use the fields from the product
template.
Delegation
Enterprise
● View inheritance in Odoo lets child views extend base
views without replacing them. Using inherit_id, extension
views can add or remove elements via XPath components
in the arch field.
● In other words, these extensions allow you to add or
remove elements from the parent view
View Inheritance
Enterprise
Enterprise
We can examine each attribute used for view inheritance:
1. XPath Tag Within the `arch` Field:
`expr="//page[@name='hr_settings']"`: This XPath expression
targets a specific element within the original view.
2. Position:
This attribute determines the placement of the field,
specifying whether it should be added before, after, or replace
the targeted element.
Xpath Attributes
Enterprise
Additionally, we can inherit views in two ways:
Xpath Attributes
Enterprise
Enterprise
Inheritance in Odoo 18 enhances development by promoting
code reusability and maintainability. It allows extending models
and views efficiently while ensuring consistent updates across
the application.
Conclusion
For More Info.
Check our company website for related blogs
and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Enterprise
www.cybrosys.com

More Related Content

PPTX
Delegation Inheritance in Odoo 17 and Its Use Cases
PPTX
How to make a component and add it to systray in Odoo
PPTX
What is Delegation Inheritance in Odoo 15
PPTX
What is Model Inheritance in Odoo 17 ERP
PPTX
What is Property Fields in Odoo 17 ERP Module
PPTX
Traditional Prototype Inheritance in Odoo 15 |
PPTX
Inheritance _ Delegation Inheritance in Odoo 16
PPTX
How to Install Custom Module in Odoo 17 - Odoo 17 Slides
Delegation Inheritance in Odoo 17 and Its Use Cases
How to make a component and add it to systray in Odoo
What is Delegation Inheritance in Odoo 15
What is Model Inheritance in Odoo 17 ERP
What is Property Fields in Odoo 17 ERP Module
Traditional Prototype Inheritance in Odoo 15 |
Inheritance _ Delegation Inheritance in Odoo 16
How to Install Custom Module in Odoo 17 - Odoo 17 Slides

Similar to Different types of inheritance in odoo 18 (20)

PDF
Migrating from CA AllFusionTM ERwin® Data Modeler to ER/Studio
PPTX
What is Mixin Class & How to Use Mixin Classes in Odoo 18
PPTX
Tips On Trick Odoo Add-On.pptx
PDF
Migrating from CA AllFusionTM ERwin® Data Modeler to Embarcadero ER/Studio
PPTX
Design patterns fast track
PDF
Migrating erwin-to-erstudio-data-modeling-solutions
PPTX
Odoo (Build module, Security, ORM)
DOCX
ASP.NET MVC3 RAD
PDF
4 pillars of OOPS CONCEPT
PPTX
Odoo 15 Traditional Class Inheritance
PPTX
Useful environment methods in Odoo 18 - Odoo Slides
PPTX
How to create Security Group and Manage Access Rights in Odoo 18
PPTX
CSC2161Programming_in_Cpp_Lecture4-OOP Classes and Objects[1].pptx
PPTX
How to Get Metadata Method in Odoo 17 - Odoo 17 Slides
PDF
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
PPTX
How to use Init Hooks in Odoo 18 - Odoo Slides
PPTX
Inheritance _ Traditional Class Inheritance in Odoo 16
PPTX
Tips On Trick Odoo Add-On.pptx
PPTX
Security, Groups, and Access Rights in Odoo 17
PPTX
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Migrating from CA AllFusionTM ERwin® Data Modeler to ER/Studio
What is Mixin Class & How to Use Mixin Classes in Odoo 18
Tips On Trick Odoo Add-On.pptx
Migrating from CA AllFusionTM ERwin® Data Modeler to Embarcadero ER/Studio
Design patterns fast track
Migrating erwin-to-erstudio-data-modeling-solutions
Odoo (Build module, Security, ORM)
ASP.NET MVC3 RAD
4 pillars of OOPS CONCEPT
Odoo 15 Traditional Class Inheritance
Useful environment methods in Odoo 18 - Odoo Slides
How to create Security Group and Manage Access Rights in Odoo 18
CSC2161Programming_in_Cpp_Lecture4-OOP Classes and Objects[1].pptx
How to Get Metadata Method in Odoo 17 - Odoo 17 Slides
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
How to use Init Hooks in Odoo 18 - Odoo Slides
Inheritance _ Traditional Class Inheritance in Odoo 16
Tips On Trick Odoo Add-On.pptx
Security, Groups, and Access Rights in Odoo 17
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Ad

More from Celine George (20)

PPTX
How to Implement OWL Notification Service in Odoo 18
PPTX
Tracking Profit Margins in Sales Orders with Odoo 18
PPTX
How to Configure Outgoing Shipment in 3 Steps Using Odoo 18
PPTX
How to Configure Outgoing Shipment in 1 Step Using Odoo 18.pptx
PPTX
How to Configure Outgoing Shipment in 2 Steps Using Odoo 18
PPTX
How to Add New Applicants in Odoo 18 Recruitment
PPTX
How to Analyze the Recruitment Process in Odoo 18 Recruitment
PPTX
How to Manage Referral Reporting in Odoo 18 Referrals
PPTX
How to Set, Track, & Review Employee Goals in Odoo 18 Appraisals
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
How to Manage Bill Control Policy in Odoo 18
PPTX
How to Manage Loyalty Points in Odoo 18 Sales
PPTX
Odoo 18 Sales_ Managing Quotation Validity
PPTX
How to Manage Global Discount in Odoo 18 POS
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
How to Implement OWL Notification Service in Odoo 18
Tracking Profit Margins in Sales Orders with Odoo 18
How to Configure Outgoing Shipment in 3 Steps Using Odoo 18
How to Configure Outgoing Shipment in 1 Step Using Odoo 18.pptx
How to Configure Outgoing Shipment in 2 Steps Using Odoo 18
How to Add New Applicants in Odoo 18 Recruitment
How to Analyze the Recruitment Process in Odoo 18 Recruitment
How to Manage Referral Reporting in Odoo 18 Referrals
How to Set, Track, & Review Employee Goals in Odoo 18 Appraisals
Revamp in MTO Odoo 18 Inventory - Odoo Slides
How to Manage Starshipit in Odoo 18 - Odoo Slides
How to Manage Bill Control Policy in Odoo 18
How to Manage Loyalty Points in Odoo 18 Sales
Odoo 18 Sales_ Managing Quotation Validity
How to Manage Global Discount in Odoo 18 POS
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Tips Management in Odoo 18 POS - Odoo Slides
How to Close Subscription in Odoo 18 - Odoo Slides
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
How to Track Skills & Contracts Using Odoo 18 Employee
Ad

Recently uploaded (20)

PDF
Computing-Curriculum for Schools in Ghana
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
GDM (1) (1).pptx small presentation for students
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
01-Introduction-to-Information-Management.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
master seminar digital applications in india
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Basic Mud Logging Guide for educational purpose
PDF
RMMM.pdf make it easy to upload and study
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Lesson notes of climatology university.
Computing-Curriculum for Schools in Ghana
Renaissance Architecture: A Journey from Faith to Humanism
GDM (1) (1).pptx small presentation for students
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
01-Introduction-to-Information-Management.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
O7-L3 Supply Chain Operations - ICLT Program
Abdominal Access Techniques with Prof. Dr. R K Mishra
Microbial disease of the cardiovascular and lymphatic systems
Sports Quiz easy sports quiz sports quiz
Pharma ospi slides which help in ospi learning
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
master seminar digital applications in india
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Cell Structure & Organelles in detailed.
Basic Mud Logging Guide for educational purpose
RMMM.pdf make it easy to upload and study
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Lesson notes of climatology university.

Different types of inheritance in odoo 18

  • 1. Different types of inheritance in odoo 18 Enterprise
  • 2. Enterprise In Odoo 18, inheritance enables seamless customization of modules, from data models and views to methods and interfaces. This slide outlines the different types of inheritance techniques for extending functionality effectively. Introduction
  • 3. Enterprise The two types of inheritance in Odoo are, 1- Model Inheritance 2- View Inheritance Types of Inheritance
  • 4. Enterprise Odoo offers three main types of model inheritance: 1) Delegation 2) Extension 3) Classical inheritance. Model Inheritance
  • 6. Enterprise In Odoo, when both the `_inherit` and `_name` attributes are used together, the new model builds upon the existing model specified by `_inherit`. This allows the new model to inherit all the fields, methods, and metadata (such as defaults) from the base model. Classical Inheritance
  • 8. Enterprise In the code above, two classes are defined: a parent class and a child class. The parent class only specifies the `_name` attribute, while the child class defines both `_name` and `_inherit`. This allows the child model to inherit the fields and functions of the parent class. Let’s now see how this works in practice: Explanation
  • 9. Enterprise In this way, the child model can access the data, fields, and functions of the parent model.
  • 10. Enterprise When using the extension form of inheritance, only the _inherit attribute is needed, without the _name attribute. This replaces the original model with the new one, while allowing us to add more fields or functionalities to the existing model. Below is an example of how to implement extended inheritance: Extension
  • 12. Enterprise When we inspect the database, we can see that the field `description` has been added to the model `extension.extension`. We use the _inherits attribute for delegation inheritance. This type of inheritance allows you to link another model to your current model without altering the views. As a result, the database tables will contain both a field for the inherited object and the data from your model. Below is an example of how to implement delegation inheritance: Delegation
  • 14. Enterprise In Odoo, we can observe that the product template contains several `many2one` fields in the product model. Odoo provides multiple examples of this setup. These fields are stored exclusively in the product template table, although the product model can access and use the fields from the product template. Delegation
  • 15. Enterprise ● View inheritance in Odoo lets child views extend base views without replacing them. Using inherit_id, extension views can add or remove elements via XPath components in the arch field. ● In other words, these extensions allow you to add or remove elements from the parent view View Inheritance
  • 17. Enterprise We can examine each attribute used for view inheritance: 1. XPath Tag Within the `arch` Field: `expr="//page[@name='hr_settings']"`: This XPath expression targets a specific element within the original view. 2. Position: This attribute determines the placement of the field, specifying whether it should be added before, after, or replace the targeted element. Xpath Attributes
  • 18. Enterprise Additionally, we can inherit views in two ways: Xpath Attributes
  • 20. Enterprise Inheritance in Odoo 18 enhances development by promoting code reusability and maintainability. It allows extending models and views efficiently while ensuring consistent updates across the application. Conclusion
  • 21. For More Info. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com