Limit digit to positive integer when formatting float in domain parser
Closes #14557 (grafted from 319126552d56ef1dd8a03e457071df0d40d0607e) --HG-- branch : 7.0
This commit is contained in:
@@ -2205,6 +2205,7 @@
|
||||
}
|
||||
var factor = Number(field.factor || 1);
|
||||
digit -= Math.round(Math.log10(factor));
|
||||
digit = Math.max(digit, 0);
|
||||
return (value * factor).toLocaleString(
|
||||
Sao.i18n.BC47(Sao.i18n.getlang()), {
|
||||
useGrouping: true,
|
||||
|
||||
@@ -349,8 +349,8 @@ def format_value(field, value, target=None, context=None, _quote_empty=False):
|
||||
cast = float
|
||||
factor = cast(field.get('factor', 1))
|
||||
digit -= round(math.log10(factor))
|
||||
return locale.localize(
|
||||
'{0:.{1}f}'.format(value * factor or 0, digit), True)
|
||||
digit = max(digit, 0)
|
||||
return locale.localize('{0:.{1}f}'.format(value * factor, digit), True)
|
||||
|
||||
def format_selection():
|
||||
if isinstance(field['selection'], (tuple, list)):
|
||||
|
||||
Reference in New Issue
Block a user