Unit 4
Unit 4
SEMESTER: 4
PREPARED BY: Ms. Kiran Rajput
Introduction to ORM in Odoo
•What is ORM?
• Object-Relational Mapping
• Facilitates interaction between Python objects and
database tables
•Benefits of ORM:
• Simplifies database operations
• Reduces boilerplate code
2
Traditional ORM Methods
•Example:
3
Advanced ORM Methods
•Advanced Operations:
•Search Read: search_read()
•Copy: copy()
•Get: get()
•Example:
4
Procedure from the GUI
•Follow-Up Method:
• Review changes in the database through the GUI
• Validate data integrity and relationships
5
API Decorations in Odoo
•@api.model
•@api.multi
•@api.depends
•@api.onchange
6
Differences Between Versions
•Version Changes:
• New features and deprecations in
different Odoo versions
•Key Differences:
• Changes in API methods and
behavior
• Migration considerations for
upgrading
7
Odoo Calls
•Common Calls:
•self.env['model.name']
•self.browse()
•self.search()
8
Most Used API Decorations
9
Relational Field Operations with the API
•Example:
partner = self.env['res.partner'].browse(partner_id)
orders = partner.order_ids
10
Review of Commonly Used ORM Methods
11
PMS Editing and Expression
•Using Expressions:
•Filtering and searching using domain expressions
•Example:
12