This commit is contained in:
Michael (mcm) 2021-11-26 13:18:44 +01:00
parent 0ea53d6a0d
commit 055c4aab2c

View File

@ -45,37 +45,37 @@ The component of a field receives several props:
- Description - Description
* - `archs` * - `archs`
- `object?` - `object?`
- description... -
* - `attrs` * - `attrs`
- `object` - `object`
- description... -
* - `id` * - `id`
- `string?` - `string?`
- description... -
* - `name` * - `name`
- `string` - `string`
- The field's name - The field's name
* - `options` * - `options`
- `object` - `object`
- description... -
* - `readonly` * - `readonly`
- `boolean` - `boolean`
- description... -
* - `required` * - `required`
- `boolean` - `boolean`
- description... -
* - `record` * - `record`
- `DataPoint` - `DataPoint`
- description... -
* - `type` * - `type`
- `string` - `string`
- The field's base type. - The field's base type.
* - `update` * - `update`
- `function` - `function`
- description... -
* - `value` * - `value`
- `any` - `any`
- description... -
How to use a field How to use a field
@ -99,7 +99,7 @@ Reference List
* - :ref:`BooleanFavoriteField <frontend/fields/boolean_favorite_field>` * - :ref:`BooleanFavoriteField <frontend/fields/boolean_favorite_field>`
- `boolean_favorite` - `boolean_favorite`
- `boolean` - `boolean`
- description... -
* - :ref:`BooleanField <frontend/fields/boolean_field>` * - :ref:`BooleanField <frontend/fields/boolean_field>`
- `boolean` - `boolean`
- `boolean` - `boolean`
@ -107,89 +107,89 @@ Reference List
* - :ref:`BooleanToggleField <frontend/fields/boolean_toggle_field>` * - :ref:`BooleanToggleField <frontend/fields/boolean_toggle_field>`
- `boolean_toggle` - `boolean_toggle`
- `boolean` - `boolean`
- description... -
* - :ref:`CharField <frontend/fields/char_field>` * - :ref:`CharField <frontend/fields/char_field>`
- `char` - `char`
- `char` - `char`
- description... -
* - :ref:`ColorField <frontend/fields/color_field>` * - :ref:`ColorField <frontend/fields/color_field>`
- `color` - `color`
- `char` - `char`
- description... -
* - :ref:`ColorPickerField <frontend/fields/color_picker_field>` * - :ref:`ColorPickerField <frontend/fields/color_picker_field>`
- `color_picker` - `color_picker`
- `integer` - `integer`
- description... -
* - :ref:`DateField <frontend/fields/date_field>` * - :ref:`DateField <frontend/fields/date_field>`
- `date` - `date`
- `date`, `datetime` - `date`, `datetime`
- description... -
* - :ref:`DateTimeField <frontend/fields/datetime_field>` * - :ref:`DateTimeField <frontend/fields/datetime_field>`
- `datetime` - `datetime`
- `datetime` - `datetime`
- description... -
* - :ref:`EmailField <frontend/fields/email_field>` * - :ref:`EmailField <frontend/fields/email_field>`
- `text` - `email`
- `char` - `char`
- display email addresses - display email addresses
* - :ref:`HandleField <frontend/fields/handle_field>` * - :ref:`HandleField <frontend/fields/handle_field>`
- `handle` - `handle`
- `integer` - `integer`
- description... -
* - :ref:`ImageField <frontend/fields/image_field>` * - :ref:`ImageField <frontend/fields/image_field>`
- `image` - `image`
- `binary` - `binary`
- description... -
* - :ref:`Many2ManyCheckboxesField <frontend/fields/many2many_checkboxes_field>` * - :ref:`Many2ManyCheckboxesField <frontend/fields/many2many_checkboxes_field>`
- `many2many_checkboxes` - `many2many_checkboxes`
- `many2many` - `many2many`
- description... -
* - :ref:`Many2ManyTagsField <frontend/fields/many2many_tags_field>` * - :ref:`Many2ManyTagsField <frontend/fields/many2many_tags_field>`
- `many2many_tags` - `many2many_tags`
- `many2many` - `many2many`
- description... -
* - :ref:`Many2oneField <frontend/fields/many2one_field>` * - :ref:`Many2oneField <frontend/fields/many2one_field>`
- `many2one` - `many2one`
- `many2one` - `many2one`
- description... -
* - :ref:`PercentageField <frontend/fields/percentage_field>` * - :ref:`PercentageField <frontend/fields/percentage_field>`
- `text` - `percentage`
- `float` - `float`
- display percentages - display percentages
* - :ref:`PhoneField <frontend/fields/phone_field>` * - :ref:`PhoneField <frontend/fields/phone_field>`
- `text` - `phone`
- `char`, `integer` - `char`, `integer`
- display phone numbers - display phone numbers
* - :ref:`PriorityField <frontend/fields/priority_field>` * - :ref:`PriorityField <frontend/fields/priority_field>`
- `priority` - `priority`
- `selection` - `selection`
- description... -
* - :ref:`RadioField <frontend/fields/radio_field>` * - :ref:`RadioField <frontend/fields/radio_field>`
- `radio` - `radio`
- `many2one`, `selection` - `many2one`, `selection`
- description... -
* - :ref:`RemainingDaysField <frontend/fields/remaining_days_field>` * - :ref:`RemainingDaysField <frontend/fields/remaining_days_field>`
- `remaining_days` - `remaining_days`
- `date`, `datetime` - `date`, `datetime`
- description... -
* - :ref:`SelectionField <frontend/fields/selection_field>` * - :ref:`SelectionField <frontend/fields/selection_field>`
- `selection` - `selection`
- `selection` - `selection`
- description... -
* - :ref:`StatInfoField <frontend/fields/stat_info_field>` * - :ref:`StatInfoField <frontend/fields/stat_info_field>`
- `statinfo` - `statinfo`
- `float`, `integer` - `float`, `integer`
- description... -
* - :ref:`StatusBarField <frontend/fields/statusbar_field>` * - :ref:`StatusBarField <frontend/fields/statusbar_field>`
- `statusbar` - `statusbar`
- `many2one`, `selection` - `many2one`, `selection`
- description... -
* - :ref:`TextField <frontend/fields/text_field>` * - :ref:`TextField <frontend/fields/text_field>`
- `text` - `text`
- `html`, `text` - `html`, `text`
- description... -
* - :ref:`UrlField <frontend/fields/url_field>` * - :ref:`UrlField <frontend/fields/url_field>`
- `text` - `url`
- `char` - `char`
- display URLs - display URLs
@ -203,9 +203,11 @@ BooleanFavoriteField
- Technical name: `boolean_favorite` - Technical name: `boolean_favorite`
- Supported types: `boolean` - Supported types: `boolean`
The `BooleanFavoriteField` is displayed as an empty (or not) star depending on a boolean value.
.. code-block:: xml .. code-block:: xml
<field name="my_field" widget="boolean_favorite" /> <field name="is_favorite" widget="boolean_favorite" />
.. _frontend/fields/boolean_field: .. _frontend/fields/boolean_field:
@ -217,12 +219,11 @@ BooleanField
- Technical name: `boolean` - Technical name: `boolean`
- Supported types: `boolean` - Supported types: `boolean`
The `BooleanField` component represents a boolean value. It is the default field The `BooleanField` component represents a boolean value. It is the default field for all fields of type `boolean`.
for all fields of type `boolean`.
.. code-block:: xml .. code-block:: xml
<field name="my_field" widget="boolean" /> <field name="is_checked" widget="boolean" />
.. _frontend/fields/boolean_toggle_field: .. _frontend/fields/boolean_toggle_field:
@ -234,6 +235,12 @@ BooleanToggleField
- Technical name: `boolean_toggle` - Technical name: `boolean_toggle`
- Supported types: `boolean` - Supported types: `boolean`
The `BooleanToggleField` component displays a toggle switch to represent a boolean.
.. code-block:: xml
<field name="switch" widget="boolean_toggle" />
.. _frontend/fields/char_field: .. _frontend/fields/char_field:
@ -244,6 +251,27 @@ CharField
- Technical name: `char` - Technical name: `char`
- Supported types: `char` - Supported types: `char`
The `CharField` represents a single line text value. It is the default field for all fields of type `char`.
.. code-block:: xml
<field name="display_name" widget="char" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `autocomplete`
-
* - `password`
- if defined then displays "*" instead of the characters.
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/color_field: .. _frontend/fields/color_field:
@ -254,6 +282,10 @@ ColorField
- Technical name: `color` - Technical name: `color`
- Supported types: `char` - Supported types: `char`
.. code-block:: xml
<field name="color" widget="color" />
.. _frontend/fields/color_picker_field: .. _frontend/fields/color_picker_field:
@ -264,6 +296,10 @@ ColorPickerField
- Technical name: `color_picker` - Technical name: `color_picker`
- Supported types: `integer` - Supported types: `integer`
.. code-block:: xml
<field name="color" widget="color_picker" />
.. _frontend/fields/date_field: .. _frontend/fields/date_field:
@ -274,6 +310,10 @@ DateField
- Technical name: `date` - Technical name: `date`
- Supported types: `date`, `datetime` - Supported types: `date`, `datetime`
.. code-block:: xml
<field name="invoice_date" widget="date" />
.. _frontend/fields/datetime_field: .. _frontend/fields/datetime_field:
@ -284,6 +324,11 @@ DateTimeField
- Technical name: `datetime` - Technical name: `datetime`
- Supported types: `datetime` - Supported types: `datetime`
.. code-block:: xml
<field name="now" widget="datetime" />
.. _frontend/fields/email_field: .. _frontend/fields/email_field:
EmailField EmailField
@ -297,6 +342,7 @@ The `EmailField` component represents a textual value containing an email addres
is an input with the `email` type in edit mode, and a link with an `href` in readonly mode with is an input with the `email` type in edit mode, and a link with an `href` in readonly mode with
the `mailto:` prefix. It opens an email application if available whenever a click is made by the user. the `mailto:` prefix. It opens an email application if available whenever a click is made by the user.
.. _frontend/fields/handle_field: .. _frontend/fields/handle_field:
HandleField HandleField
@ -306,6 +352,10 @@ HandleField
- Technical name: `handle` - Technical name: `handle`
- Supported types: `integer` - Supported types: `integer`
.. code-block:: xml
<field name="sequence" widget="handle" />
.. _frontend/fields/image_field: .. _frontend/fields/image_field:
@ -316,6 +366,10 @@ ImageField
- Technical name: `image` - Technical name: `image`
- Supported types: `binary` - Supported types: `binary`
.. code-block:: xml
<field name="picture" widget="image" />
.. _frontend/fields/many2many_checkboxes_field: .. _frontend/fields/many2many_checkboxes_field:
@ -326,6 +380,10 @@ Many2ManyCheckboxesField
- Technical name: `many2many_checkboxes` - Technical name: `many2many_checkboxes`
- Supported types: `many2many` - Supported types: `many2many`
.. code-block:: xml
<field name="options" widget="many2many_checkboxes" />
.. _frontend/fields/many2many_tags_field: .. _frontend/fields/many2many_tags_field:
@ -336,6 +394,10 @@ Many2ManyTagsField
- Technical name: `many2many_tags` - Technical name: `many2many_tags`
- Supported types: `many2many` - Supported types: `many2many`
.. code-block:: xml
<field name="tags" widget="many2many_tags" />
.. _frontend/fields/many2one_field: .. _frontend/fields/many2one_field:
@ -346,6 +408,22 @@ Many2OneField
- Technical name: `many2one` - Technical name: `many2one`
- Supported types: `many2one` - Supported types: `many2one`
.. code-block:: xml
<field name="currency_id" widget="many2one" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/percentage_field: .. _frontend/fields/percentage_field:
PercentageField PercentageField
@ -361,6 +439,7 @@ decimal (e.g. `0.5671` would be converted to `56.7%`). When the user enters the
value is still visible as a percentage, but the inner value is not rounded this time. In the value is still visible as a percentage, but the inner value is not rounded this time. In the
end, the value is always saved as a float value. end, the value is always saved as a float value.
.. _frontend/fields/phone_field: .. _frontend/fields/phone_field:
PhoneField PhoneField
@ -375,6 +454,7 @@ an input with the `phone` type in edit mode, and a link with an `href` in readon
The link contains the `tel:` prefix which means that it starts a call to the given number The link contains the `tel:` prefix which means that it starts a call to the given number
whenever a user clicks on it. whenever a user clicks on it.
.. _frontend/fields/priority_field: .. _frontend/fields/priority_field:
PriorityField PriorityField
@ -384,6 +464,10 @@ PriorityField
- Technical name: `priority` - Technical name: `priority`
- Supported types: `selection` - Supported types: `selection`
.. code-block:: xml
<field name="priority_level" widget="priority" />
.. _frontend/fields/radio_field: .. _frontend/fields/radio_field:
@ -394,6 +478,21 @@ RadioField
- Technical name: `radio` - Technical name: `radio`
- Supported types: `many2one`, `selection` - Supported types: `many2one`, `selection`
.. code-block:: xml
<field name="question_type" widget="radio" />
`options` attribute supports the following properties:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `horizontal`
-
.. _frontend/fields/remaining_days_field: .. _frontend/fields/remaining_days_field:
@ -404,6 +503,21 @@ RemainingDaysField
- Technical name: `remaining_days` - Technical name: `remaining_days`
- Supported types: `date`, `datetime` - Supported types: `date`, `datetime`
.. code-block:: xml
<field name="meeting_date" widget="remaining_days" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/selection_field: .. _frontend/fields/selection_field:
@ -412,7 +526,24 @@ SelectionField
- Location: `@web/fields/selection_field` - Location: `@web/fields/selection_field`
- Technical name: `selection` - Technical name: `selection`
- Supported types: `selection` - Supported types: `many2one`, `selection`
The `SelectionField` component displays a `<select>` html tag.
.. code-block:: xml
<field name="taxes" widget="selection" placeholder="Select a tax" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/stat_info_field: .. _frontend/fields/stat_info_field:
@ -424,6 +555,21 @@ StatInfoField
- Technical name: `statinfo` - Technical name: `statinfo`
- Supported types: `float`, `integer` - Supported types: `float`, `integer`
.. code-block:: xml
<field name="meeting_count" widget="statinfo" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/statusbar_field: .. _frontend/fields/statusbar_field:
@ -434,6 +580,21 @@ StatusBarField
- Technical name: `statusbar` - Technical name: `statusbar`
- Supported types: `many2one`, `selection` - Supported types: `many2one`, `selection`
.. code-block:: xml
<field name="status" widget="statusbar" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/text_field: .. _frontend/fields/text_field:
@ -444,6 +605,22 @@ TextField
- Technical name: `text` - Technical name: `text`
- Supported types: `html`, `text` - Supported types: `html`, `text`
.. code-block:: xml
<field name="description" widget="text" />
It supports the following attributes:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Name
- Description
* - `placeholder`
- a string which is used to display some info when no value is selected.
.. _frontend/fields/url_field: .. _frontend/fields/url_field:
UrlField UrlField