[float formatting] [fix] take precision from global defaults

This commit is contained in:
Anand Doshi 2013-04-03 13:32:17 +05:30
parent eb90343bdb
commit 66adf5fdff
2 changed files with 10 additions and 4 deletions

View file

@ -894,10 +894,16 @@ FloatField.prototype.format_input = function() {
this.input.value='';
else {
var format;
if(this.get_field_currency)
if(this.get_field_currency) {
format = get_number_format(this.get_field_currency());
this.input.value =
format_number(parseFloat(this.input.value), format);
this.input.value =
format_number(parseFloat(this.input.value), format);
} else {
var decimals = wn.boot.sysdefaults.float_precision ?
parseInt(wn.boot.sysdefaults.float_precision) : null;
this.input.value = format_number(parseFloat(this.input.value), null, decimals);
}
}
}
FloatField.prototype.onmake_input = function() {

View file

@ -11,7 +11,7 @@ wn.form.formatters = {
parseInt(wn.boot.sysdefaults.float_precision) : null;
return "<div style='text-align: right'>" +
format_number(flt(value, decimals), null, decimals) + "</div>";
format_number(value, null, decimals) + "</div>";
},
Int: function(value) {
return cint(value);