Parcourir la source

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

version-14
Anand Doshi il y a 12 ans
Parent
révision
66adf5fdff
2 fichiers modifiés avec 10 ajouts et 4 suppressions
  1. +9
    -3
      public/js/legacy/widgets/form/fields.js
  2. +1
    -1
      public/js/wn/form/formatters.js

+ 9
- 3
public/js/legacy/widgets/form/fields.js Voir le fichier

@@ -894,10 +894,16 @@ FloatField.prototype.format_input = function() {
this.input.value=''; this.input.value='';
else { else {
var format; var format;
if(this.get_field_currency)
if(this.get_field_currency) {
format = get_number_format(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() { FloatField.prototype.onmake_input = function() {


+ 1
- 1
public/js/wn/form/formatters.js Voir le fichier

@@ -11,7 +11,7 @@ wn.form.formatters = {
parseInt(wn.boot.sysdefaults.float_precision) : null; parseInt(wn.boot.sysdefaults.float_precision) : null;


return "<div style='text-align: right'>" + return "<div style='text-align: right'>" +
format_number(flt(value, decimals), null, decimals) + "</div>";
format_number(value, null, decimals) + "</div>";
}, },
Int: function(value) { Int: function(value) {
return cint(value); return cint(value);


Chargement…
Annuler
Enregistrer