[IMP] web: FieldInteger and FieldFloat can use input of type number

This allow the browser/device to handle the experience of handling number in a more native way.

FieldInteger and FieldFloat now inherits from NumericField because we want
to format it or not dependent of the view (readonly or edit) and the
NumericField will manage it.

We do that because input type number can't take a value with comma on Chrome
(FireFox is more permissive but not perfect because comma is the separator
for decimal in this case).

Task #1880376
This commit is contained in:
svs-odoo
2018-09-07 16:18:45 +02:00
committed by Géry Debongnie
parent 16aeecc73d
commit 74fcd3ac3b
3 changed files with 227 additions and 30 deletions
+35
View File
@@ -1397,6 +1397,23 @@ order.
- Supported field types: *integer*
Options:
- type: setting the input type (*text* by default, can be set on *number*)
On edit mode, the field is rendered as an input with the HTML attribute type
setted on *number* (so user can benefit the native support, especially on
mobile). In this case, the default formatting is disabled to avoid incompability.
.. code-block:: xml
<field name="int_value" options='{"type": "number"}'/>
- step: set the step to the value up and down when the user click on buttons
(only for input of type number, 1 by default)
.. code-block:: xml
<field name="int_value" options='{"type": "number", "step": 100}'/>
- float (FieldFloat)
This is the default field type for fields of type *float*.
@@ -1411,6 +1428,24 @@ order.
<field name="factor" digits="[42,5]"/>
Options:
- type: setting the input type (*text* by default, can be set on *number*)
On edit mode, the field is rendered as an input with the HTML attribute type
setted on *number* (so user can benefit the native support, especially on
mobile). In this case, the default formatting is disabled to avoid incompability.
.. code-block:: xml
<field name="int_value" options='{"type": "number"}'/>
- step: set the step to the value up and down when the user click on buttons
(only for input of type number, 1 by default)
.. code-block:: xml
<field name="int_value" options='{"type": "number", "step": 0.1}'/>
- float_time (FieldFloatTime)
The goal of this widget is to display properly a float value that represents
a time interval (in hours). So, for example, 0.5 should be formatted as 0:30,