Widgets rendering¶
Widgets offer the possibility of assigning a widget type, allowing for multiple variants for the same field type.
Types¶
The type of the field can be overloaded by the widget.
Supported widget types :
- date
- string
- text
- link
- file
Example with a moment
field defined as datetime, which should be displayed as a simple date:
{
"type": "field",
"value": "moment",
"width": "33%",
"widget": {
"type": "date"
}
}
Other values are possible for specific field types:
boolean: * toggle (default) * checkbox
many2one: * select (default: inline selection with typeahead, with the possibility of new context for creation or advanced selection)
one2many: * list (default) * multiselect (multi-select input view)
many2many: * list (default) * multiselect (multi-select input view)
Usages¶
The widget variant can also be assigned using the usage
property.
Most official content-types and also:
- 'color'
- 'icon'
- 'url'
{
"type": "field",
"value": "description",
"width": "50%",
"widget": {
"usage": "text/plain"
}
}
Example with an issue_date
field defined as datetime, which should be displayed with a specific format (here short):
{
"type": "field",
"value": "issue_date",
"width": "15%",
"widget": {
"usage": "datetime/short"
}
}