diff options
| author | Andrea Grazioso (agr-odoo) <agr@odoo.com> | 2019-12-24 10:05:17 +0000 |
|---|---|---|
| committer | Andrea Grazioso (agr-odoo) <agr@odoo.com> | 2020-01-06 12:16:10 +0000 |
| commit | bbe944c8298555238708141a90bf45df3cc295ce (patch) | |
| tree | d6baf6ca1d8a6173480dcd98f30f31ea342031e7 /addons/web/static/src/js/fields | |
| parent | f62d91670bd272870f155157686b509d3cbf8abd (diff) | |
[FIX] web: avoid parsing value if already number
When accessing stock_barcode module to validate pickings, is not
possible to add floating point quantities for any localizaton which uses
',' as decimal separator.
The numeric field is now defined via browser tags <input="numeric"> to
make the numeric keyboard popup automatically on mobile devices
(commit 8f5840369b28962ab2be9edfce7331a836c3df22)
Adding the override to avoid further processing when the input
is already anumber
opw-2154657
closes odoo/odoo#42748
X-original-commit: 1ccc60deeb067f8d461d48cbf51719317c22cb90
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/fields')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 37e61c8fd5b..6b2e9cbe7c7 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -431,6 +431,22 @@ var NumericField = InputField.extend({ }, /** + * Parse numerical value (integer or float) + * + * Note: We have to overwrite this method to skip the format if we are into + * edit mode on a input type number. + * + * @override + * @private + */ + _parseValue: function (value) { + if (this.mode === 'edit' && this.nodeOptions.type === 'number') { + return Number(value); + } + return this._super.apply(this, arguments); + }, + + /** * Formats an input element for edit mode. This is in a separate function so * extending widgets can use it on their input without having input as tagName. * |
