How Odoo Computes Fields Internally (store=True vs store=False)
Introduction
Computed fields are one of the most powerful features in Odoo. They allow developers to derive values automatically based on other fields, reducing manual work and ensuring data consistency.
However, choosing between store=True and store=False is not just a technical detail—it directly impacts performance, database structure, and user experience.
In this blog, we’ll explore how Odoo computes fields internally, how dependency tracking works, and when you should use store=True or store=False, with clear explanations and practical code examples.
This blog explains:
How Odoo computes fields behind the scenes
The internal behavior of stored vs non-stored computed fields
When each option should be used
Common mistakes and performance implications
All examples are compatible with Odoo 19.
What Is a Computed Field in Odoo?
A computed field is a field whose value is calculated using a Python method instead of being manually entered by the user. Odoo automatically recomputes this field whenever its dependent fields change.
Common use cases include:
Calculating totals
Deriving status fields
Computing age or duration
Flags based on conditions
Basic Syntax of a Computed Field
In this example, total_discount is computed dynamically based on order line values.
How Odoo Tracks Dependencies Internally
Odoo uses the @api.depends() decorator to build a dependency graph. This graph tells the ORM:
Which fields affect the computed field
When recomputation is required
Whenever a dependent field changes, Odoo marks the computed field as dirty and schedules it for recomputation.
store=False (Non-Stored Computed Fields)
By default, computed fields are not stored in the database.
How It Works Internally
No database column is created
The compute method runs every time the field is read
Value exists only in memory
Example
Advantages
Always shows real-time data
No database storage overhead
Simple dependency handling
Limitations
Slower for large recordsets
Cannot be searched, filtered, or grouped
Not ideal for tree or kanban views
Best Use Cases
Display-only values
Small datasets
Frequently changing data
store=True (Stored Computed Fields)
When store=True is set, Odoo saves the computed value in the database.
How It Works Internally
A database column is created
Value is computed only when dependencies change
Stored value is reused during read operations
Example
Advantages
Faster read performance
Searchable and groupable
Ideal for reporting and dashboards
Limitations
Uses database storage
Incorrect dependencies can cause wrong data
Slightly more complex to maintain
Best Use Cases
Fields used in filters and domains
Large datasets
Frequently accessed values
Performance Comparison
When comparing stored and non-stored computed fields, performance and usability behave very differently. Non-stored fields (store=False) are recalculated every time they are accessed, which can slow down list views, kanban views, and reports when working with large datasets.
However, they always show real-time values.
Stored computed fields (store=True) are calculated only when their dependent fields change. Because the value is saved in the database, read operations are much faster, and the field can be used in filters, search domains, group by, and reports. The trade-off is that accuracy depends on correct dependency definitions.
Common Mistakes Developers Make
Forgetting to add @api.depends() for stored fields
Using store=False fields in kanban or list views
Overusing store=True for rarely accessed data
How Odoo Decides When to Recompute
Internally, Odoo follows these steps:
A dependent field is updated
ORM marks the computed field as dirty
Compute method is triggered
Value is recalculated
Stored in database if store=True
This mechanism ensures optimal performance while maintaining data consistency.
Conclusion
Understanding how Odoo computes fields internally is essential for building efficient and scalable modules. While store=False works well for dynamic and lightweight values, store=True is crucial for performance-critical and searchable fields.
Choosing the right approach based on your use case will help you avoid performance issues and deliver a smoother user experience.
If you are looking for an ERP implementation partner with diverse industry experience feel free to contact us. We have proven track record of successful implementations across various sectors including Odoo for Manufacturing, Odoo for Trading, Odoo for FMCG, Odoo for Oil & Gas, Odoo for Diary, Odoo for Pharma, Odoo for Cosmetic Clinic, Odoo for Contracting Companies, Odoo for HVAC, Odoo for Logistics, Odoo for Automobile, Odoo for Laundry, Odoo for Field Service, Odoo for E-Commerce & many more
ZestyBeanz offers Developer / Consultant outsourcing programs, Chat with us in Whatsapp and Hire Odoo Developers, Mobile Application Developers, Consultants.
#OdooDevelopment #Odoo18 #CustomChatterButton #TechnicalBlog #OdooCustomization #OdooTips #Odoofeatures