Skip to content

9. Widgets - Display vs Data Storage

The Golden Rule

Widgets change how a field LOOKS, not what it STORES.

Think of widgets like different picture frames - the photo inside stays the same, but the presentation changes.

Real Example You See Every Day

The "Status" field on a Sales Order stores a simple value like 'draft' or 'sale'. But look how differently it can appear:

LocationWidgetDisplay
In the headerwidget="statusbar"Horizontal pipeline: Quotation → Sales Order → Locked
In list viewwidget="badge"Colored pill/tag

Same field, same data (state = 'sale'), completely different look!

Widgets by Category

Selection Field Widgets

Selection fields store a single choice from a list. These widgets change how users pick that choice:

WidgetLooks LikeBest ForWhere You've Seen It
selection (default)Dropdown menuMany options, save spaceCountry selection, Payment terms
radioRadio buttons2-4 options, all visibleInvoice type (Customer/Vendor)
statusbarHorizontal pipelineDocument workflow stagesSales Order status, Invoice status
badgeColored pill/tagStatus in list viewsOrder status column in list
priorityStars (★★★)Priority/importanceLead priority in CRM

Relationship Field Widgets

These change how you select and display linked records:

WidgetLooks LikeBest ForWhere You've Seen It
many2one (default)Dropdown with searchStandard relationshipCustomer on Sales Order
many2one_avatarName + small imageRecords with imagesProduct selection
many2one_avatar_userUser avatar + nameUser assignmentsSalesperson, Assigned To
many2many_tagsColored tag pillsMultiple selectionsProduct Tags, Employee Skills
many2many_checkboxesCheckbox listFixed small set of optionsAccess groups selection

Number and Money Widgets

WidgetLooks LikeBest ForWhere You've Seen It
float (default)Plain numberGeneral quantitiesQuantity field
monetary$ 1,234.56Money amountsUnit Price, Total Amount
percentage25.00 %PercentagesDiscount %, Margin %
progressbarVisual progress barCompletion trackingProject completion, Task progress
integerWhole number onlyCounts, sequencesSequence number

Date and Time Widgets

WidgetLooks LikeBest ForWhere You've Seen It
date (default)Date pickerSingle datesInvoice Date, Due Date
daterangeStart → End pickerDate rangesLeave requests, Project dates
remaining_days"In 5 days" / "3 days ago"DeadlinesDue date display

Text and Content Widgets

WidgetLooks LikeBest ForWhere You've Seen It
char (default)Single line inputShort textName, Reference
textMulti-line textareaLong plain textInternal notes
htmlRich text editorFormatted contentProduct description, Email body
urlClickable linkWebsite URLsPartner website
emailClickable mailto linkEmail addressesContact email
phoneClickable tel linkPhone numbersContact phone
CopyClipboardCharText + copy buttonCodes to copyTracking numbers, API keys

Binary and Image Widgets

WidgetLooks LikeBest ForWhere You've Seen It
binary (default)Upload/download buttonAny fileAttachments
imageImage previewPhotos, logosProduct image, Partner logo
pdf_viewerEmbedded PDF viewerPDF documentsInvoice PDF preview

Special Purpose Widgets

WidgetUsed ForWhere You've Seen It
handleDrag to reorder rowsOrder lines, Pricelist items
boolean_toggleOn/Off switch instead of checkboxSettings toggles
colorColor pickerStage colors in Kanban
domainDomain builder UIFilter rules in automated actions
aceCode editor with syntax highlightingPython code in server actions

How to Specify a Widget

In XML Views

Add the widget attribute to a field:

xml
<!-- In form view -->
<field name="state" widget="statusbar"/>
<field name="user_id" widget="many2one_avatar_user"/>
<field name="tag_ids" widget="many2many_tags"/>

<!-- In list view -->
<field name="state" widget="badge"/>
<field name="priority" widget="priority"/>

In Studio

  1. Open Studio on the form/list view
  2. Click on the field you want to change
  3. In the properties panel, find "Widget"
  4. Select from the dropdown

Note

Studio only shows widgets compatible with that field type.

Common Widget Mistakes

Watch Out For These

MistakeWhat HappensSolution
Using monetary without currency_fieldNo currency symbol shownEnsure model has a currency_id field linked
Using statusbar on non-Selection fieldWidget doesn't renderOnly works with Selection fields
Using many2many_tags on Many2oneError or strange behaviorUse many2one_avatar instead
Using image on non-Binary fieldNothing displaysImage widget needs Binary field type

Widgets Don't Change Data

Remember This

If you change a widget:

  • ✓ The display changes
  • ✓ The user experience changes
  • ✗ The stored data does NOT change
  • ✗ Reports using that field are NOT affected
  • ✗ API responses are NOT affected

Widgets are purely a presentation layer concern.

Test Your Knowledge

Q1: You change a Selection field from displaying as a dropdown to displaying as radio buttons (using widget="radio"). What happens to existing data in that field?

  • A) All existing data is cleared and must be re-entered
  • B) The data is converted to a new format in the database
  • C) Nothing - the stored data remains exactly the same, only the display changes ✓
  • D) The field becomes read-only
Answer

Correct Answer: C

Widgets only affect how data is displayed in the UI - they never modify the underlying data storage. Changing from dropdown to radio buttons is purely cosmetic. The database stores the same selection value regardless of which widget presents it.

Q2: A user wants to see the Sales Order "Status" field displayed as a clickable pipeline in the form header (showing Quotation → Sales Order → Locked). Which widget should be used?

  • A) widget="badge"
  • B) widget="statusbar"
  • C) widget="selection"
  • D) widget="priority"
Answer

Correct Answer: B

The statusbar widget displays selection/many2one fields as a horizontal pipeline of stages. Users can click on stages to change the status. It's commonly used in form headers to show workflow progression like Quotation → Sales Order.

Q3: What widget would you use to display a Many2many field as colorful, removable tags?

  • A) widget="many2many_tags"
  • B) widget="text"
  • C) widget="char"
  • D) widget="selection"
Answer

Correct Answer: A

The many2many_tags widget displays records as colorful, removable tags. It's typically used with Many2many fields to show related records in an intuitive, visual way that makes multi-value selection easy.

Widget Quick Reference by Field Type

For Selection Fields

WidgetUse When
selectionMany options, standard dropdown
radio2-4 options, all visible at once
statusbarDocument workflow in form header
badgeStatus display in list views
priorityStar rating for importance

For Relational Fields

WidgetUse When
many2oneStandard single selection
many2one_avatarShow image with name
many2one_avatar_userUser assignment with avatar
many2many_tagsMultiple colored tags
many2many_checkboxesSmall fixed set as checkboxes

For Numeric Fields

WidgetUse When
floatStandard decimal number
monetaryCurrency amounts (needs currency_field)
percentageShow as percentage with % symbol
progressbarVisual completion indicator
integerWhole numbers only

For Text Fields

WidgetUse When
charSingle line text
textMulti-line plain text
htmlRich text with formatting
emailClickable email link
phoneClickable phone link
urlClickable website link

Requesting Widget Changes

When asking a developer to change a widget:

"Please change the [field name] field on [model/view] to use the [widget name] widget."

Example requests:

  • "Please change the status field in the order list view to use the badge widget"
  • "Please change the assigned user field to use many2one_avatar_user"
  • "Please change the priority field to use the priority widget (stars)"