[IMP] web_decimal_numpad_dot: now changes . for , in floating numbers

pull/828/head
oihane 2015-11-13 09:18:09 +01:00 committed by David
parent e41aeaf760
commit 04c92b6fed
1 changed files with 16 additions and 19 deletions

View File

@ -6,18 +6,15 @@ instance.web.form.FieldFloat = instance.web.form.FieldChar.extend({
is_field_number: true, is_field_number: true,
widget_class: 'oe_form_field_float', widget_class: 'oe_form_field_float',
events: { events: {
"keyup": "floatKeyup", "keypress": "floatKeypress",
}, },
floatKeyup: function(e){ floatKeypress: function(e){
var code = e.which ? e.which : e.keyCode; if(e.keyCode == '46' || e.charCode == '46'){
//Cancel the keypress
if (code === 110){ e.preventDefault();
var input = this.$("input").val(); // Add the comma to the value of the input field
input = input.substr(0, input.length -1); this.$("input").val(this.$("input").val() + ',');
input += instance.web._t.database.parameters.decimal_point;
this.set("value", input);
} }
}, },
}); });
})(); })();