Forms¶
routes¶
Form views may hold a routes element, specific to the current view, and that contains a series of descriptors that are used to display button s on the right pane.
Example of routes definition
Booking.form.json | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
"routes": [
{
"id": "print.pdf",
"label": "Print tender",
"description": "",
"icon": "print",
"route": "/?get=renover_tender-pdf&id=object.id",
"target": "_blank",
"absolute": true
}
]
layout¶
Form views hold a layout element that contains all the information needed to display a single object in the view.
At the root of their layout descriptor, form views have a single array of groups descriptors. When rendered, a form view have all its groups shown one below another.
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
groups | list of Group | Groups of Section used to split the page horizontally |
groups¶
Groups are horizontal part of a form view, containing sections.
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
id | string |
unique, used for translations. |
label | string |
(optional) name used when no translation is available. |
sections | list of Section | list of section, represented as tabs |
sections¶
Section contain a part of the layout presented in rows and columns.
If a group has more than 1 section, its sections are presented tabs.
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
id | string |
unique id, used for translations. |
label | string |
(optional) name used when no translation is available. |
rows | list of Row | |
visible | array >domain |
Domain that use the context to allow display of the section or not |
rows¶
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
id | string |
unique id, used for translations. |
label | string |
(optional) name used when no translation is available. |
rows | list of Column | |
visible | array >domain |
Domain that use the context to allow display of the section or not |
columns¶
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
id | string |
unique id, used for translations. |
label | string |
(optional) name used when no translation is available. |
rows | list of Item | |
visible | array >domain |
Domain that use the context to allow display of the section or not |
width | integer >number/natural:100 |
width of the column |
items¶
Items are a descriptor of the way a field or a label of a Model is displayed in a view.
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
id | string |
(optional) unique id, used for traductions (traductions override label and value) |
label | string |
(optional) override the value for the title value of the item |
type | string |
type of item (either field or label ) |
width | integer >number/natural:100 |
width of the field (in percentage its parent) |
readonly | boolean |
tell if the item is editable in a creation or edtition context of the usage of the view |
visible | boolean or array >domain |
tell if the item should be displayed |
widget | Widget | Give properties to the item, depends on the type of view |
widget¶
Widget are used to set properties that depends on the type of view.
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
link | boolean |
Flag telling if the content of the item a link. |
heading | boolean |
Emphasizes the item (large version of the widget). |
type | string |
edit the type of display of the item, depends on the type of the field. |
usage | string |
override the usage of the field to display it. |
There are some additional properties depending on the type of field the item relates to:
Relational fields (one2many, many2many)
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
header | Header | Associative Field Only. Override the header of the view to display the relation. |
domain | array >domain |
Associative Field Only. Override the domain of the view to display the relation. |
view | string |
Associative Field Only. Provide the id of the view to use to display the relation. |
one2many
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
autoselect | boolean |
One2Many Field Only. Item is automatically selected when list contains only 1 (default = true). |
many2one
PROPERTY | TYPE | DESCRIPTION |
---|---|---|
fields | array |
Many2One Field Only. List of sub-fields to be loaded. |
For many2one
fields, since the display involves the name, an object is requested (instead of simply the id).
The default fields that are requested are id
and name
. However, it is possible to specify additional subfields. This is might be necessary if those are involved in a domain within the view (as a filter or a visibility condition).
Path to sub fields
If sub-objects are required, a path can be specified using the dot notation (e.g. object.target_id.target_field
).
Example:
{
"type": "field",
"label": "Booking",
"value": "booking_id",
"width": "100%",
"widget": {
"fields": ["customer_id", "customer_identity_id.name"],
"readonly": true
}
}
For relational fields, the header has an impact on the layout of the corresponding widget in a form view.
For instance, for many2one fields, header information is used to display (or not) the buttons for creating a new item or opening the selected item in a new context.
By modifying the header, it is therefore possible to deactivate the display of these buttons.
"widget": {
"header": {
"actions": {
"ACTION.CREATE": false,
"ACTION.OPEN": false
}
}
}
Using keyboard inputs
Navigation between input widgets is possible via the keyboard, primarily using the <tab>
key. When opening dropdown selection boxes, the <up>
and <down>
keys allow navigation among the options.
In form views, while in edit mode, it's also possible to use the combination <ctrl+s>
to save the current form.
In the case of a split button with multiple save actions (save and continue, save and close, ...), it's the first save action that is executed.
During a keydown event, the keyboard status is captured by the visible Frame and relayed to the active context, which in turn relays it to the view (via a call to keyboardAction()
).