What Are Widgets in Odoo Views?
Widgets control how fields are displayed and edited in Odoo views. A Char field can render as a simple text input, an email link, a URL, or a phone number — all depending on the widget. Widgets are set in the XML view definition:
<field name="email" widget="email"/>
<field name="phone" widget="phone"/>
<field name="website" widget="url"/>
Text and Input Widgets
| Widget | Field Type | Description |
|---|
| char | Char | Default text input (no widget needed) |
| email | Char | Renders as clickable mailto link |
| phone | Char | Renders as clickable tel link |
| url | Char | Renders as clickable hyperlink |
| text | Text | Multi-line textarea |
| html | Html | Rich text editor (WYSIWYG) |
| char_emojis | Char | Text input with emoji picker |
| password | Char | Password dots, copy button |
| CopyClipboardChar | Char | Text with copy-to-clipboard button |
| CopyClipboardText | Text | Textarea with copy-to-clipboard button |
Usage Examples
<field name="email" widget="email"/>
<field name="phone" widget="phone"/>
<field name="api_key" widget="CopyClipboardChar"/>
<field name="description" widget="html"/>
Numeric Widgets
| Widget | Field Type | Description |
|---|
| integer | Integer | Default integer input |
| float | Float | Default float input |
| monetary | Monetary | Currency-formatted with symbol |
| percentage | Float | Shows as percentage (0.15 = 15%) |
| progressbar | Float/Integer | Visual progress bar |
| float_time | Float | Duration as HH:MM (1.5 = 01:30) |
| float_factor | Float | Multiplied display (for UoM conversion) |
<field name="amount_total" widget="monetary"/>
<field name="progress" widget="progressbar"/>
<field name="tax_rate" widget="percentage"/>
<field name="duration" widget="float_time"/>
Date and Time Widgets
| Widget | Field Type | Description |
|---|
| date | Date | Date picker |
| datetime | Datetime | Date + time picker |
| daterange | Date | Start-end date range picker |
| remaining_days | Date | Shows days remaining (e.g., "in 3 days") |
<field name="date_deadline" widget="remaining_days"/>
<field name="date_start" widget="daterange" options="{'end_date_field': 'date_end'}"/>
Relational Widgets
| Widget | Field Type | Description |
|---|
| many2one | Many2one | Default dropdown with search |
| many2one_avatar | Many2one | Shows avatar image next to name |
| many2one_avatar_user | Many2one | User avatar with online status |
| many2many_tags | Many2many | Colored tag chips |
| many2many_tags_avatar | Many2many | Tag chips with avatars |
| many2many_checkboxes | Many2many | Checkbox list |
| many2many_binary | Many2many | File attachment list |
| one2many | One2many | Inline list/form editor |
| selection | Selection | Default dropdown |
| radio | Selection | Radio button group |
| selection_badge | Selection | Badge/pill buttons |
<field name="user_id" widget="many2one_avatar_user"/>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
<field name="type" widget="radio"/>
<field name="priority" widget="selection_badge"/>
Status and State Widgets
| Widget | Field Type | Description |
|---|
| statusbar | Selection/Many2one | Step-by-step status bar at top of form |
| priority | Selection | Star rating (0-3 stars) |
| boolean_toggle | Boolean | Toggle switch instead of checkbox |
| boolean_favorite | Boolean | Star icon toggle |
<header>
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done"/>
</header>
<field name="priority" widget="priority"/>
<field name="is_favorite" widget="boolean_favorite" nolabel="1"/>
<field name="active" widget="boolean_toggle"/>
Image and Binary Widgets
| Widget | Field Type | Description |
|---|
| image | Binary | Image display with upload |
| binary | Binary | File upload/download |
| pdf_viewer | Binary | Inline PDF viewer |
| color | Integer | Color index picker (0-11) |
| color_picker | Char | Hex color picker |
<field name="image_1920" widget="image" class="oe_avatar"/>
<field name="attachment" widget="binary" filename="attachment_name"/>
<field name="color" widget="color"/>
Special Widgets
| Widget | Field Type | Description |
|---|
| domain | Char | Visual domain builder |
| ace | Text | Code editor (syntax highlighting) |
| handle | Integer | Drag handle for reordering |
| badge | Selection/Char | Colored badge display |
| label_selection | Selection | Colored label |
| statinfo | Integer/Float | Stat button display |
<field name="domain" widget="domain" options="{'model': 'res.partner'}"/>
<field name="code" widget="ace" options="{'mode': 'python'}"/>
<field name="sequence" widget="handle"/>
<button class="oe_stat_button" icon="fa-envelope">
<field name="message_count" widget="statinfo" string="Messages"/>
</button>
Widget Options
Many widgets accept options via the options attribute in JSON format:
<!-- Many2many tags with colors -->
<field name="tag_ids" widget="many2many_tags"
options="{'color_field': 'color', 'no_create': True}"/>
<!-- Many2one with no create/edit -->
<field name="partner_id"
options="{'no_create': True, 'no_create_edit': True, 'no_open': True}"/>
<!-- Image with size limit -->
<field name="image" widget="image"
options="{'size': [200, 200], 'preview_image': 'image_128'}"/>
Tips for Choosing Widgets
- Use
statusbar for workflow states — it shows the progression visually - Use
many2many_tags for tags and labels — much better UX than a list - Use
monetary for all currency fields — it handles formatting and currency symbols - Use
remaining_days for deadline fields — instantly shows urgency - Use
boolean_toggle instead of raw checkbox for better mobile UX - Use
CopyClipboardChar for API keys, URLs, and reference codes