From ac127f0986e3ec6e485ba67ac750aee30bd45e3f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 21 Mar 2013 17:40:08 +0530 Subject: [PATCH] merge --- webnotes/utils/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webnotes/utils/__init__.py b/webnotes/utils/__init__.py index 159f4addab..5dd20f8699 100644 --- a/webnotes/utils/__init__.py +++ b/webnotes/utils/__init__.py @@ -366,7 +366,7 @@ def parse_val(v): v = int(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 """ @@ -403,6 +403,11 @@ def fmt_money(amount, precision=None): amount = comma_str.join(parts) + (precision and (decimal_str + decimals) or "") amount = minus + amount + + if currency: + symbol = webnotes.conn.get_value("Currency", currency, "symbol") + if symbol: + amount = symbol + " " + amount return amount