|
@ -1,23 +1,20 @@ |
|
|
(function() { |
|
|
(function() { |
|
|
|
|
|
|
|
|
var instance = openerp; |
|
|
|
|
|
|
|
|
var instance = openerp; |
|
|
|
|
|
|
|
|
instance.web.form.FieldFloat = instance.web.form.FieldChar.extend({ |
|
|
|
|
|
|
|
|
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){ |
|
|
|
|
|
var code = e.which ? e.which : e.keyCode; |
|
|
|
|
|
|
|
|
|
|
|
if (code === 110){ |
|
|
|
|
|
var input = this.$("input").val(); |
|
|
|
|
|
input = input.substr(0, input.length -1); |
|
|
|
|
|
input += instance.web._t.database.parameters.decimal_point; |
|
|
|
|
|
this.set("value", input); |
|
|
|
|
|
|
|
|
floatKeypress: function(e){ |
|
|
|
|
|
if(e.keyCode == '46' || e.charCode == '46'){ |
|
|
|
|
|
//Cancel the keypress
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
// Add the comma to the value of the input field
|
|
|
|
|
|
this.$("input").val(this.$("input").val() + ','); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
})(); |
|
|
})(); |