diff options
Diffstat (limited to 'addons/barcodes/static')
| -rw-r--r-- | addons/barcodes/static/src/js/field_float_scannable.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/barcodes/static/src/js/field_float_scannable.js b/addons/barcodes/static/src/js/field_float_scannable.js index 1a461f0048c..79022362251 100644 --- a/addons/barcodes/static/src/js/field_float_scannable.js +++ b/addons/barcodes/static/src/js/field_float_scannable.js @@ -2,6 +2,7 @@ odoo.define('barcodes.FieldFloatScannable', function(require) { "use strict"; var core = require('web.core'); +var formats = require('web.formats'); var form_widgets = require('web.form_widgets'); // Field in which the user can both type normally and scan barcodes @@ -14,6 +15,13 @@ var FieldFloatScannable = form_widgets.FieldFloat.extend({ 'keypress': 'simulateKeypress', }, + // Widget values are parsed according to the widget type. Since this widget is of type + // "FieldFloatScannable" and there is no parsing planned for this type, it defaults + // to outputting the value as a string. Hence the need to redefine parse_value + parse_value: function(val, def) { + return formats.parse_value(val, {type: "float"}, def); + }, + simulateKeypress: function (e) { var character = String.fromCharCode(e.which); var current_str = e.target.value; |
