diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-01-05 15:51:49 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-01-05 15:51:49 +0100 |
| commit | 31ce19bd7c8ff90aa3a3f34ba13dfbbe00865b3b (patch) | |
| tree | 4f24c985d7f4f7d08af1830f8199b120f35018f7 /addons/barcodes/static | |
| parent | 9b5311e0c94ea2b3ad6c36bc9a4ea63228779b66 (diff) | |
| parent | 97e87a42cdfaed04a6f50d928d86ac6e3bec9f91 (diff) | |
[MERGE] forward port of branch 9.0 up to 97e87a4
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; |
