Introduction
The Boolean field is one of the simplest field types in Odoo, and also one of the most used. Every time you tick a checkbox on a sales order, mark a customer as active, or flag a product as a favorite, you are interacting with a Boolean field.
Despite its simplicity, the Boolean field has a few behaviors worth understanding properly. Knowing when to use it, when not to use it, and how to configure it well will help you build cleaner Odoo environments and avoid some common mistakes that even experienced teams make.
This guide covers the Boolean field from every angle: what it stores, how it behaves in the Odoo data model and the user interface, how to create or customize it using Odoo Studio or Python, real business use cases, and practical tips to get the most out of this field type.
What is the Boolean Field in Odoo
In the Odoo ORM, the Boolean field stores one of two values: True or False. It maps directly to a BOOLEAN column in PostgreSQL. There is no ambiguity here: the field is either checked or unchecked, enabled or disabled, yes or no.
From the user perspective, a Boolean field appears as a checkbox in form views. In list views, it typically displays as a checkmark icon when the value is True and nothing when it is False. In some configurations it appears as a toggle switch instead of a traditional checkbox, depending on the widget applied.
Here is what a Boolean field definition looks like in a Python Odoo module:
from odoo import fields, models
class SaleOrder(models.Model):
_inherit = 'sale.order'
needs_manual_review = fields.Boolean(
string='Needs Manual Review',
default=False,
)
The string parameter sets the label shown in the interface. The default parameter controls the initial value when new records are created. Without a default, Odoo treats the field as False automatically, but it is considered good practice to declare it explicitly.
In Odoo Studio, this same field type is simply called a Checkbox. Fields created through Studio receive an x_studio_ prefix automatically. When created through Python or the XML-RPC API, you define the technical name yourself.
How the Field Works
When you add a Boolean field to an Odoo model, the framework creates the corresponding column in the PostgreSQL database automatically during module installation or upgrade. No manual SQL migration is needed.
One important thing to understand: in Odoo, a Boolean field never holds None or NULL. The ORM always returns either True or False. Even if the database column has no value, Odoo will return False when you read the field. This is different from other field types like Many2one or Char, where an empty value comes back as False or None and you have to check for both.
Key Field Attributes
Here are the main properties you can configure on a Boolean field in the Odoo framework:
- default: Sets the value when a new record is created. Almost always set to
False, but can beTruefor opt-out scenarios. - compute: Links a Python method that calculates the value dynamically. Useful for derived flags based on the state of other fields.
- store: When used with
compute, determines whether the value is saved in the database. Withstore=True, computed Boolean fields can be used in search filters and reports. - readonly: Prevents users from manually changing the field value in the interface. Common for computed flags that should only be set by the system.
- copy: Controls whether the field value is carried over when duplicating a record. Defaults to
True. For flags like "is approved", you typically wantcopy=Falseso duplicated records start clean. - groups: Restricts visibility and editing to specific user groups.
How It Appears in Views
In form views, a Boolean field renders as a standard HTML checkbox. In list views, Odoo shows a check icon for True and nothing for False by default. This makes list views easy to scan visually.
You can change how a Boolean field renders using view widgets. The toggle widget displays it as a switch instead of a checkbox, which works well for settings or preferences. For read-only display, the boolean_favorite widget renders the value as a star icon, which you can see on product and contact forms in standard Odoo.
Using Boolean Fields in Domain Filters
Boolean fields are very convenient to use in Odoo domains, which are the filter expressions used in search views, automated actions, and access rules. A filter for unchecked records looks like this:
[('needs_manual_review', '=', True)]
Since there are only two possible values, you can also use the simpler form without the operator:
[('needs_manual_review', '=', False)]
This straightforward filtering behavior is one reason Boolean fields integrate so cleanly with Odoo automated actions, scheduled actions, and server actions. They are easy to check and act on without complex conditions.
Interaction with the Odoo ORM
Reading and writing Boolean fields in Odoo development is as direct as it gets. You access the value on the record object, compare it with True or False, and assign it directly. The ORM handles everything else. There are no conversions, no serialization edge cases, and no surprises when passing values through the XML-RPC API either, since True and False map cleanly to their XML-RPC boolean equivalents.
Business Use Cases
Boolean fields appear across every department in a typical Odoo implementation. Here are five practical examples from real business workflows.
CRM: Tracking Whether a Lead Has Been Qualified
Sales teams often need to flag which leads have been reviewed by a senior rep and confirmed as viable opportunities. A Boolean field called is_qualified on the CRM lead model gives teams an easy way to filter their pipeline. Unqualified leads can be handled by junior staff, while the qualified ones get prioritized attention. This simple checkbox replaces the need for a dedicated stage or a status field just for this purpose.
Sales: Flagging Orders That Need Manual Review
In some businesses, certain sales orders require extra approval before being confirmed, for example orders above a certain amount or for new customers. A Boolean field needs_manual_review on the sale order, combined with an automated action that sets it to True based on business rules, gives the finance or operations team a clear queue to work from. They can filter the orders list by this field and process approvals without digging through the full order list.
Inventory: Marking Products as Out of Catalog
When a product is no longer sold but still needs to remain in the system for historical records, archiving it is not always the right option. A Boolean field is_discontinued on the product template lets purchasing and sales teams see at a glance that the item should not be reordered or quoted to customers. You can use this field in price list filters, purchase order validation rules, and website shop visibility settings.
Accounting: Identifying Invoices That Require Attention
Finance teams sometimes need to flag invoices that have been disputed, contain a pricing discrepancy, or are waiting for a credit note. Rather than relying on free-text notes in the chatter, a Boolean field under_dispute gives the team a structured way to filter and report on these invoices. Automated reminders can also be suppressed for invoices with this flag set to True, preventing unnecessary payment pressure on a customer while an issue is being resolved.
HR: Tracking Certifications and Training Completion
HR departments often need to confirm that employees have completed mandatory training or hold a required certification. A Boolean field on the employee record, such as safety_training_completed, provides a simple and auditable way to track this. Managers can filter their team list to see who still needs to complete the training, and the data can feed into compliance reports without building a complex dedicated module.
Creating or Customizing the Boolean Field
There are three main approaches to adding a Boolean field to an Odoo model, depending on your technical setup and the level of customization you need.
Using Odoo Studio (No Code)
Odoo Studio is the built-in low-code tool for customizing Odoo without writing any Python or XML. To add a Boolean field through Studio:
- Open Odoo Studio from the main menu (requires the Studio app).
- Navigate to the form where you want to add the field.
- Drag a Checkbox field from the sidebar onto the form layout.
- Set the label, default value, and any required or read-only constraints in the field properties panel.
- Save and close Studio.
Studio handles everything automatically: the field is created in the database with an x_studio_ prefix and added to the view. No restart or upgrade is required.
Using Python in a Custom Module
For developers building Odoo modules, Boolean fields are defined directly in Python model files. This is the recommended approach for any customization that needs to be version-controlled, tested, and deployed across multiple environments:
from odoo import fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
x_is_key_account = fields.Boolean(
string='Key Account',
default=False,
copy=False,
)
After defining the field, you add it to the relevant view XML file so it appears in the interface. Odoo creates the database column when the module is installed or upgraded.
For computed Boolean fields, the pattern looks like this:
from odoo import api, fields, models
class SaleOrder(models.Model):
_inherit = 'sale.order'
is_high_value = fields.Boolean(
string='High Value Order',
compute='_compute_is_high_value',
store=True,
)
@api.depends('amount_total')
def _compute_is_high_value(self):
for order in self:
order.is_high_value = order.amount_total >= 10000
With store=True, the computed value is saved in the database, making it available in search filters and list view grouping without recalculating on every page load.
Using the XML-RPC API
If you manage Odoo customizations programmatically, for instance as part of a deployment pipeline or a remote configuration script, Boolean fields can be created via the XML-RPC API on the ir.model.fields model:
field_id = models.execute_kw(
ODOO_DB, uid, ODOO_API_KEY,
'ir.model.fields', 'create',
[{
'name': 'x_needs_manual_review',
'field_description': 'Needs Manual Review',
'model_id': model_id,
'ttype': 'boolean',
'state': 'manual',
}]
)
The state: manual value tells Odoo this field was created outside of a module, which is the correct setting for fields created through Studio or the API. This is exactly how Dasolo handles remote field creation for clients as part of automated configuration workflows.
Best Practices
1. Always define a default value
Even though Odoo returns False for Boolean fields with no default, it is best practice to declare default=False explicitly in your field definition. It communicates intent clearly to anyone reading the model code and prevents ambiguity when the field is used in automated actions or filters.
2. Use descriptive names that read as questions
Boolean field names work best when they read naturally as a yes/no question. Names like is_verified, needs_approval, has_warranty, or is_key_account are immediately understandable. Avoid vague names like flag, status, or check, which tell you nothing about what the field actually represents.
3. Set copy=False for approval and status flags
If your Boolean field represents a state that should not carry over when a record is duplicated, for example "is approved" or "has been sent", always add copy=False. Otherwise, duplicating a record will copy the flag value, which can lead to records appearing approved or sent when they have not been through the proper process.
4. Use computed Boolean fields for derived states
Avoid writing server actions or Python code that manually updates a Boolean field in response to other field changes. Instead, define it as a computed field with @api.depends(). This keeps your logic in one place, runs automatically on every save, and is much easier to maintain and debug than scattered write operations across multiple places in the codebase.
5. Add Boolean fields to search views when they are used for filtering
If users regularly need to filter records based on a Boolean field, add it explicitly to the search view. In Studio, enable the search option in the field properties panel. In code, add it to the <search> view XML. This gives users a clean filter button in the search bar rather than forcing them to use advanced filters every time.
Common Pitfalls
Using Boolean for a state that has more than two options
This is the most common mistake teams make with Boolean fields. If a record can be in one of three or more states, like "pending", "approved", and "rejected", a Boolean field is the wrong tool. You end up adding a second Boolean, then a third, and the logic becomes impossible to manage. Use a Selection field or a proper status workflow instead. Boolean fields are for genuinely binary situations.
Forgetting to set copy=False on approval flags
When users duplicate records in Odoo, all field values are copied by default. An order that was marked as "approved" or "reviewed" will have those flags set to True on the duplicate immediately. If the duplicated record should start from a clean slate, add copy=False to every flag that represents a completed action or a reached state.
Not adding the field to the search view
A Boolean field that users need to filter on, but that is not in the search view, forces them to open the advanced filter dialog every time. This slows down daily workflows significantly. If you add a Boolean field that people will use to find records, take the extra step to add it to the search view at the same time.
Using a Boolean field instead of the active field
Odoo has a built-in active field on most models that controls whether records appear in standard views. If your Boolean field is meant to hide or archive records, use the native active field and its toggle mechanism rather than building a custom visibility solution. This keeps your data model aligned with standard Odoo behavior and plays well with the archive and unarchive actions already built into the UI.
Computed Boolean fields without store=True in filters
If you create a computed Boolean field and try to use it in search filters or list view grouping without store=True, Odoo will raise an error or silently ignore the filter. Non-stored computed fields exist only in memory and cannot be used in SQL queries. If a computed Boolean needs to be filterable or reportable, always add store=True to the field definition.
Conclusion
The Boolean field is the kind of field you stop noticing precisely because it works so well. It is everywhere in Odoo, from the active flag that controls record visibility, to the is_published field that drives your website, to the dozens of custom flags that businesses add to their own workflows every day.
Understanding how it behaves in the Odoo data model, how to configure it properly with the right defaults and attributes, and when to use it versus other field types like Selection will help you build implementations that are clean, predictable, and easy to maintain.
A Boolean field done well is invisible to the end user. It just works. A Boolean field used incorrectly creates confusion, corrupted states, and a growing pile of workarounds. The difference comes down to knowing the rules and applying them consistently.
At Dasolo, we help companies implement, customize, and optimize Odoo across all departments. Whether you need help designing a clean data model, adding custom fields to your workflows, or building a full Odoo module from scratch, our team is here to support you. Reach out to us and let's talk about your Odoo project.