SlideShare a Scribd company logo
4
Most read
6
Most read
7
Most read
Object Relational Mapping
in Odoo 16
ORM(Object Relational Mapping) is a concept or technique which
acts as a bridge between your programming language and your
database. The Object Relational Mapping helps to execute SQL
queries without writing them explicitly. Once the ORM is
configured in an application, the user can use the OOP concepts
like classes and objects to interact with the database.
Major functions of ORM are
● Create :
Model.create(vals_list)
Create() method is used to create new records in a model.vals_list is the dictionary used to
initialize new records using the value.
● Write :
Model.write(vals)
Which is used to update all records in the current set with the specified values.
● Search/Read :
Model.search(args[, offset=0][, limit=None][, order=None][, count=False])
Which searches for the records in the args domain.
Model.search_count(args)
Which returns the number of records in the current model that matches the specified domain.
Model.name_search(name='', args=None, operator='ilike', limit=100)
It finds records with a display name that matches the specified name pattern when compared
to the specified operator and also matches the optional search domain (argument).
This method is the same as calling search () on the search domain based on display_name and
then name_get () based on the search results.
Model.read([fields])
Read the requested field of the record, And it is a low level / RPC method. In Python code, use
browse ().
● Browse
Model.browse([ids])
Returns a record set of IDs provided as parameters in the current environment.
Model.read_group(domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True)
Gets a list of records in the listview grouped by the specified group by field.
● Fields/Views
Model.fields_get([fields][, attributes])
Returns the definition of each field.
The return value is the dictionary (indexed by field name). Contains the _inherits'd fields.
Strings, help, and selections (if any) attributes are converted.
Model.fields_view_get([view_id | view_type='form'])
Gets the detailed configuration of the requested view, including fields, models, and view
architecture.
● Unlink
Model.unlink()
Delete the records in the current record set.
Model.exists()
The present () method returns a subset of the records that exist within itself. Returns a
recordset containing only the records that exist in the database. It can also be used to check if
a particular record still exists.
Model.ensure_one()
The ensure_one() method checks if the record set contains only one record. If not, throw an
exception.
● Filter
Model.filtered(func)
Which returns the record which satisfies func.
• Map
Model.mapped(func)
Apply func to all of its own records and return the result as a list or record (if func returns a
record). In the latter case, the order of the returned records is arbitrary.
• Sort
Model.sorted(key=None, reverse=False)
Returns a self-ordered Recordset with the key.
With ORM, you don't have to worry about creating databases or mapping fields between
front-end databases. The table and its fields are automatically created based on the class you
created in Odoo. You may also need to perform some calculations and perform some
operations before adding them to the database. This can be overridden via the Odoo Orm
method to perform such operations.
Check our company website
for related blogs and Odoo book.
https://www.youtube.com/watch?v=A8MEl4BfqyY

More Related Content

PPTX
Create Data Files and Load Data in Odoo 15
PPTX
Odoo ORM Methods | Object Relational Mapping in Odoo15
PPTX
Odoo (Build module, Security, ORM)
PPTX
How to Use Constraint and SQL Constraint in Odoo 15
PPTX
Actions and menus in odoo 16
PPTX
What is Delegation Inheritance in Odoo 15
PPTX
Empower your App by Inheriting from Odoo Mixins
PDF
The Odoo JS Framework
Create Data Files and Load Data in Odoo 15
Odoo ORM Methods | Object Relational Mapping in Odoo15
Odoo (Build module, Security, ORM)
How to Use Constraint and SQL Constraint in Odoo 15
Actions and menus in odoo 16
What is Delegation Inheritance in Odoo 15
Empower your App by Inheriting from Odoo Mixins
The Odoo JS Framework

What's hot (20)

PPTX
How to Define One2Many Field in Odoo 15
PPTX
How to Build Custom Module in Odoo 15
PPTX
Owl: The New Odoo UI Framework
PPT
Django
PPTX
Tutorial: Develop an App with the Odoo Framework
PDF
Odoo External API
PPTX
View Inheritance in Odoo 16
PPTX
Developing New Widgets for your Views in Owl
PPTX
Odoo's Test Framework - Learn Best Practices
PPTX
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
PDF
Taller de Maquetación Web
PPT
Protege tutorial
PPTX
Widgets in odoo
PDF
Workshop 21: React Router
PDF
ReactJS presentation
PPTX
Basic Views in Odoo 16
PPTX
What is context? How to use context in Odoo by weblearns
PDF
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
PPTX
scaffold method odoo 16
PPTX
What Is Virtual DOM In React JS.pptx
How to Define One2Many Field in Odoo 15
How to Build Custom Module in Odoo 15
Owl: The New Odoo UI Framework
Django
Tutorial: Develop an App with the Odoo Framework
Odoo External API
View Inheritance in Odoo 16
Developing New Widgets for your Views in Owl
Odoo's Test Framework - Learn Best Practices
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
Taller de Maquetación Web
Protege tutorial
Widgets in odoo
Workshop 21: React Router
ReactJS presentation
Basic Views in Odoo 16
What is context? How to use context in Odoo by weblearns
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
scaffold method odoo 16
What Is Virtual DOM In React JS.pptx
Ad

Similar to Object Relation Mapping in Odoo 16 (20)

PDF
MongoDB.pdf54teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer
PPTX
DSA(Lec-1,2,3) For C++ Introduction for basics
ODP
Knolx Session: Introducing Extractors in Scala
PDF
DATA STRUCTRES ARRAY AND STRUCTURES CHAPTER 2
PDF
DATA STRUCTURE ARRAY AND STRUCTURES CHAPTER 2
PDF
Mongophilly indexing-2011-04-26
PDF
Object Oriented Programming with C#
PDF
Robust Real-Time Synchronization between Textual and Graphical Editors
PPTX
25. ORM QuerySet. .pptx
PDF
Indexing and Query Optimizer (Richard Kreuter)
PDF
Indexing and Query Optimizer (Mongo Austin)
PDF
Indexing and Query Optimizer
PPTX
Java8: what's new and what's hot
PPTX
5. c sharp language overview part ii
PDF
Mongoseattle indexing-2010-07-27
DOCX
unit 4,Indexes in database.docx
PPT
Generics collections
ODP
James Jesus Bermas on Crash Course on Python
PPTX
C# overview part 2
PPTX
DS_PPT.pptx
MongoDB.pdf54teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer
DSA(Lec-1,2,3) For C++ Introduction for basics
Knolx Session: Introducing Extractors in Scala
DATA STRUCTRES ARRAY AND STRUCTURES CHAPTER 2
DATA STRUCTURE ARRAY AND STRUCTURES CHAPTER 2
Mongophilly indexing-2011-04-26
Object Oriented Programming with C#
Robust Real-Time Synchronization between Textual and Graphical Editors
25. ORM QuerySet. .pptx
Indexing and Query Optimizer (Richard Kreuter)
Indexing and Query Optimizer (Mongo Austin)
Indexing and Query Optimizer
Java8: what's new and what's hot
5. c sharp language overview part ii
Mongoseattle indexing-2010-07-27
unit 4,Indexes in database.docx
Generics collections
James Jesus Bermas on Crash Course on Python
C# overview part 2
DS_PPT.pptx
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

Recently uploaded (20)

PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Institutional Correction lecture only . . .
PPTX
Pharma ospi slides which help in ospi learning
PDF
RMMM.pdf make it easy to upload and study
PDF
Business Ethics Teaching Materials for college
PPTX
Cell Structure & Organelles in detailed.
PDF
01-Introduction-to-Information-Management.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
VCE English Exam - Section C Student Revision Booklet
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
102 student loan defaulters named and shamed – Is someone you know on the list?
STATICS OF THE RIGID BODIES Hibbelers.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Institutional Correction lecture only . . .
Pharma ospi slides which help in ospi learning
RMMM.pdf make it easy to upload and study
Business Ethics Teaching Materials for college
Cell Structure & Organelles in detailed.
01-Introduction-to-Information-Management.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Supply Chain Operations Speaking Notes -ICLT Program
human mycosis Human fungal infections are called human mycosis..pptx
PPH.pptx obstetrics and gynecology in nursing
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
VCE English Exam - Section C Student Revision Booklet

Object Relation Mapping in Odoo 16

  • 2. ORM(Object Relational Mapping) is a concept or technique which acts as a bridge between your programming language and your database. The Object Relational Mapping helps to execute SQL queries without writing them explicitly. Once the ORM is configured in an application, the user can use the OOP concepts like classes and objects to interact with the database.
  • 3. Major functions of ORM are ● Create : Model.create(vals_list) Create() method is used to create new records in a model.vals_list is the dictionary used to initialize new records using the value. ● Write : Model.write(vals) Which is used to update all records in the current set with the specified values. ● Search/Read : Model.search(args[, offset=0][, limit=None][, order=None][, count=False]) Which searches for the records in the args domain.
  • 4. Model.search_count(args) Which returns the number of records in the current model that matches the specified domain. Model.name_search(name='', args=None, operator='ilike', limit=100) It finds records with a display name that matches the specified name pattern when compared to the specified operator and also matches the optional search domain (argument). This method is the same as calling search () on the search domain based on display_name and then name_get () based on the search results. Model.read([fields]) Read the requested field of the record, And it is a low level / RPC method. In Python code, use browse (). ● Browse Model.browse([ids]) Returns a record set of IDs provided as parameters in the current environment.
  • 5. Model.read_group(domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True) Gets a list of records in the listview grouped by the specified group by field. ● Fields/Views Model.fields_get([fields][, attributes]) Returns the definition of each field. The return value is the dictionary (indexed by field name). Contains the _inherits'd fields. Strings, help, and selections (if any) attributes are converted. Model.fields_view_get([view_id | view_type='form']) Gets the detailed configuration of the requested view, including fields, models, and view architecture.
  • 6. ● Unlink Model.unlink() Delete the records in the current record set. Model.exists() The present () method returns a subset of the records that exist within itself. Returns a recordset containing only the records that exist in the database. It can also be used to check if a particular record still exists. Model.ensure_one() The ensure_one() method checks if the record set contains only one record. If not, throw an exception.
  • 7. ● Filter Model.filtered(func) Which returns the record which satisfies func. • Map Model.mapped(func) Apply func to all of its own records and return the result as a list or record (if func returns a record). In the latter case, the order of the returned records is arbitrary. • Sort Model.sorted(key=None, reverse=False) Returns a self-ordered Recordset with the key.
  • 8. With ORM, you don't have to worry about creating databases or mapping fields between front-end databases. The table and its fields are automatically created based on the class you created in Odoo. You may also need to perform some calculations and perform some operations before adding them to the database. This can be overridden via the Odoo Orm method to perform such operations.
  • 9. Check our company website for related blogs and Odoo book. https://www.youtube.com/watch?v=A8MEl4BfqyY