Odoo provides a wide range of features to help manage business data efficiently, and one such underrated yet powerful feature is Archive. Although simple on the surface, this feature is essential for maintaining clean user interfaces and preserving historical records without permanently deleting them. In this article, we’ll explore what the Archive feature is, how it works, and how to implement it in custom models.
What Is Archive in Odoo?
The Archive feature in Odoo allows users to hide records from the user interface without actually deleting them from the database. Archived records are not shown in standard views such as lists, kanban, or search, but they remain available in the backend and can be unarchived at any time.
How Archive Works Behind the Scenes
Technically, Odoo uses a Boolean field named active
to manage the archive status of a record:
active = fields.Boolean(default=True)
The value of active
determines the visibility:
True
→ the record is active and visible in the UI.False
→ the record is archived and hidden from standard views.
For example, if a product is no longer being sold, you can archive it instead of deleting it. This keeps the data safe for future reporting and historical reference.
Benefits of Using Archive
Here are some key advantages of the Archive feature:
✅ Non-destructive Data is preserved in the database and can be restored at any time.
✅ Cleaner user interface Users only see relevant, active data.
✅ Audit-friendly Archived data remains available for traceability and compliance.
✅ Reversible Archived records can be unarchived without any data loss.
UI Example: Archiving a Product
- Navigate to Sales → Products.
- Open a product record.
- Click the Archive button at the top.
- The product disappears from the list view.
- Use the Archived filter to see hidden records.
- Click Unarchive to make the product active again.
Enabling Archive in a Custom Model
To add archive support to your custom model in Odoo, simply include the active
field like so:
from odoo import models, fields
class MyCustomModel(models.Model):
_name = 'my.custom.model'
_description = 'My Custom Model'
name = fields.Char(string='Name')
active = fields.Boolean(default=True)
Odoo will automatically add Archive / Unarchive buttons in the UI if you use the standard form or tree views.
Filtering Archived Records with Domains
By default, Odoo only shows records with active=True
. You can customize this behavior using domain filters.
Show only active records:
domain=[('active', '=', True)]
Show all records (active and archived):
domain=[]
Show only archived records:
domain=[('active', '=', False)]
Conclusion
The Archive feature in Odoo is a practical and powerful tool for long-term data management. It helps you keep the interface clean, prevents accidental data loss, and supports future reporting and auditing needs. With just a simple active
field in your custom model, you can take full advantage of this feature without complex configuration.