Rushabh Mehta 12 anni fa
parent
commit
ac127f0986
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. +6
    -1
      webnotes/utils/__init__.py

+ 6
- 1
webnotes/utils/__init__.py Vedi File

@@ -366,7 +366,7 @@ def parse_val(v):
v = int(v) v = int(v)
return v return v


def fmt_money(amount, precision=None):
def fmt_money(amount, precision=None, currency=None):
""" """
Convert to string with commas for thousands, millions etc Convert to string with commas for thousands, millions etc
""" """
@@ -403,6 +403,11 @@ def fmt_money(amount, precision=None):


amount = comma_str.join(parts) + (precision and (decimal_str + decimals) or "") amount = comma_str.join(parts) + (precision and (decimal_str + decimals) or "")
amount = minus + amount amount = minus + amount
if currency:
symbol = webnotes.conn.get_value("Currency", currency, "symbol")
if symbol:
amount = symbol + " " + amount


return amount return amount


Caricamento…
Annulla
Salva