[IMP] web: support variable digits

In v10, a `Float` field with `widget="monetary"` option uses the decimal
precision of the field. In v11, however, it uses the decimal precision
of the currency. However, in many cases `widget="monetary"` is used in
the sole purpose of displaying the currency symbol. The precision of the
field sould be kept.

This commit introduces the support of the decimal precision of the field
for this specific use case thanks to the `field_digits` option:

```
<field name="pouet" widget="monetary" options="{'field_digits': True}" />
```
If such an option is used, the field precision will prevail over the
currency precision.

Related to #21686
opw-800279
This commit is contained in:
Nicolas Martinelli
2018-01-04 11:32:04 +01:00
committed by Nicolas Martinelli
parent 8e181c99c2
commit 38e73da092
3 changed files with 52 additions and 1 deletions
@@ -568,6 +568,7 @@ var FieldMonetary = InputField.extend({
this.formatOptions.currency = this.currency;
this.formatOptions.digits = [16, 2];
this.formatOptions.field_digits = this.nodeOptions.field_digits;
},
//--------------------------------------------------------------------------