SlideShare a Scribd company logo
How to use grouped()
method in Odoo 18
Enterprise
Enterprise
Introduction
The grouped() method in Odoo is used to group records in a
recordset based on the values of a specific field or set of fields. It
simplifies the process of grouping records and iterating over the
resulting groups, which is especially useful for operations like
reporting, aggregations, or categorizing records.
Let’s discuss the various details of grouped() in Odoo 18 in the
coming slides.
Enterprise
Odoo uses grouped() method with the syntax
Model.grouped(key)
Here, key specifies the field(s) to group by.’
The method returns a dictionary where:
● Keys are the values of the grouping field(s).
● Values are recordsets of the grouped records.
Enterprise
Let’s demonstrate with an example:
Suppose we have the records from the ‘sale.order’ model and we need
to group the record set with the ‘Customer’ field(partner_id).
orders = self.env['sale.order'].search([]) # Fetch all sale orders
grouped_orders = orders.grouped('partner_id')
Here, the variable ‘orders’ contains all the sale orders created so far.
Then, the variable ‘grouped_orders’ contains the grouped data based
on the partner_id field.
Enterprise
grouped() method can be used when
● When you need to categorize or group records based on field
values.
● For performing operations on grouped records, like reporting or
aggregations.
● To simplify and clean up grouping logic in your code.
Always keep in mind that, the fields used in grouped() must be
relational fields or stored fields, as the grouping relies on ORM
lookups. The grouped() method does not support grouping by
computed fields unless they are stored in the database.
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
How to use _name_search() method in Odoo 18
PPTX
How to Use Filtered Function in Odoo 17 - Odoo Slides
PPTX
How to use search fetch method in Odoo 18
PPTX
How to Use Mapped Function in Odoo - Odoo 17 Slides
PPTX
Aggregate feature in list view odoo 17.pptx
PDF
Understanding ORM in Odoo 18: Methods and Best Practices
PPTX
How to use search_count() method in Odoo 18
PPTX
How to use search_count() method in Odoo 18
How to use _name_search() method in Odoo 18
How to Use Filtered Function in Odoo 17 - Odoo Slides
How to use search fetch method in Odoo 18
How to Use Mapped Function in Odoo - Odoo 17 Slides
Aggregate feature in list view odoo 17.pptx
Understanding ORM in Odoo 18: Methods and Best Practices
How to use search_count() method in Odoo 18
How to use search_count() method in Odoo 18

Similar to How to use grouped() method in Odoo 18 - Odoo Slides (20)

PPTX
URLs and Routing in the Odoo 17 Website App
PPTX
URLS and routing in odoo 18 - Odoo Slides
PPTX
How to Add Group by Feature in Portal - Odoo 17 Slides
PDF
Oracle Database Advanced Querying
PPTX
Oracle: Functions
PPTX
Oracle: Functions
PPTX
How to Use api.constrains ( ) in Odoo 17
DOCX
unit 4,Indexes in database.docx
PPTX
How to use ensure_one() method in Odoo 18
PDF
Understand when to use user defined functions in sql server tech-republic
PDF
Oracle Database Advanced Querying (2016)
PPTX
Simplifying SQL with CTE's and windowing functions
PDF
Oracle data integrator project
PDF
1.1 data analytics case studies and examples
PDF
Using grouping sets in sql server 2008 tech republic
PPTX
Difference between write and update in odoo 18
PPTX
Difference Between Search and Browse in Odoo 16
PPTX
Learning MongoDB Aggregations in 10 Minutes
PDF
.Net Classes and Objects | UiPath Community
PPTX
Mongo Nosql CRUD Operations
URLs and Routing in the Odoo 17 Website App
URLS and routing in odoo 18 - Odoo Slides
How to Add Group by Feature in Portal - Odoo 17 Slides
Oracle Database Advanced Querying
Oracle: Functions
Oracle: Functions
How to Use api.constrains ( ) in Odoo 17
unit 4,Indexes in database.docx
How to use ensure_one() method in Odoo 18
Understand when to use user defined functions in sql server tech-republic
Oracle Database Advanced Querying (2016)
Simplifying SQL with CTE's and windowing functions
Oracle data integrator project
1.1 data analytics case studies and examples
Using grouping sets in sql server 2008 tech republic
Difference between write and update in odoo 18
Difference Between Search and Browse in Odoo 16
Learning MongoDB Aggregations in 10 Minutes
.Net Classes and Objects | UiPath Community
Mongo Nosql CRUD Operations
Ad

More from Celine George (20)

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
PPTX
How to Apply for a Job From Odoo 18 Website
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
How to Apply for a Job From Odoo 18 Website
Ad

Recently uploaded (20)

PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Onica Farming 24rsclub profitable farm business
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Pharma ospi slides which help in ospi learning
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Introduction and Scope of Bichemistry.pptx
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PDF
Open folder Downloads.pdf yes yes ges yes
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Cardiovascular Pharmacology for pharmacy students.pptx
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Onica Farming 24rsclub profitable farm business
human mycosis Human fungal infections are called human mycosis..pptx
Week 4 Term 3 Study Techniques revisited.pptx
Microbial disease of the cardiovascular and lymphatic systems
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
Open Quiz Monsoon Mind Game Final Set.pptx
Cell Structure & Organelles in detailed.
Abdominal Access Techniques with Prof. Dr. R K Mishra
Pharma ospi slides which help in ospi learning
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Introduction and Scope of Bichemistry.pptx
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
Open folder Downloads.pdf yes yes ges yes
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx

How to use grouped() method in Odoo 18 - Odoo Slides

  • 1. How to use grouped() method in Odoo 18 Enterprise
  • 2. Enterprise Introduction The grouped() method in Odoo is used to group records in a recordset based on the values of a specific field or set of fields. It simplifies the process of grouping records and iterating over the resulting groups, which is especially useful for operations like reporting, aggregations, or categorizing records. Let’s discuss the various details of grouped() in Odoo 18 in the coming slides.
  • 3. Enterprise Odoo uses grouped() method with the syntax Model.grouped(key) Here, key specifies the field(s) to group by.’ The method returns a dictionary where: ● Keys are the values of the grouping field(s). ● Values are recordsets of the grouped records.
  • 4. Enterprise Let’s demonstrate with an example: Suppose we have the records from the ‘sale.order’ model and we need to group the record set with the ‘Customer’ field(partner_id). orders = self.env['sale.order'].search([]) # Fetch all sale orders grouped_orders = orders.grouped('partner_id') Here, the variable ‘orders’ contains all the sale orders created so far. Then, the variable ‘grouped_orders’ contains the grouped data based on the partner_id field.
  • 5. Enterprise grouped() method can be used when ● When you need to categorize or group records based on field values. ● For performing operations on grouped records, like reporting or aggregations. ● To simplify and clean up grouping logic in your code. Always keep in mind that, the fields used in grouped() must be relational fields or stored fields, as the grouping relies on ORM lookups. The grouped() method does not support grouping by computed fields unless they are stored in the database.
  • 6. 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