fix test
This commit is contained in:
parent
18538184d7
commit
b501964e1c
1 changed files with 8 additions and 7 deletions
|
|
@ -366,13 +366,14 @@ def fmt_money(amount, precision=None, currency=None):
|
|||
# 40,000 -> 40,000.00
|
||||
# 40,000.00000 -> 40,000.00
|
||||
# 40,000.23000 -> 40,000.23
|
||||
parts = str(amount).split(decimal_str)
|
||||
decimals = parts[1] if len(parts) > 1 else ''
|
||||
if precision > 2:
|
||||
if len(decimals) < 3:
|
||||
precision = 2
|
||||
elif len(decimals) < precision:
|
||||
precision = len(decimals)
|
||||
if decimal_str:
|
||||
parts = str(amount).split(decimal_str)
|
||||
decimals = parts[1] if len(parts) > 1 else ''
|
||||
if precision > 2:
|
||||
if len(decimals) < 3:
|
||||
precision = 2
|
||||
elif len(decimals) < precision:
|
||||
precision = len(decimals)
|
||||
|
||||
amount = '%.*f' % (precision, flt(amount))
|
||||
if amount.find('.') == -1:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue