浏览代码

[HOTFIX] Currency Format on Print (#4584)

* [HOTFIX] fix currency issue on print

* [HOTFIX] fix currency issue on print

* added value check for format

* added value check for format

* fix codacy
version-14
Achilles Rasquinha 7 年前
committed by Faris Ansari
父节点
当前提交
79a8be3633
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. +7
    -2
      frappe/utils/data.py

+ 7
- 2
frappe/utils/data.py 查看文件

@@ -371,12 +371,17 @@ def fmt_money(amount, precision=None, currency=None):
# 40,000 -> 40,000.00 # 40,000 -> 40,000.00
# 40,000.00000 -> 40,000.00 # 40,000.00000 -> 40,000.00
# 40,000.23000 -> 40,000.23 # 40,000.23000 -> 40,000.23

if decimal_str: if decimal_str:
parts = str(amount).split(decimal_str) parts = str(amount).split(decimal_str)
decimals = parts[1] if len(parts) > 1 else '' decimals = parts[1] if len(parts) > 1 else ''
if precision > 2: if precision > 2:
if len(decimals) < 3: if len(decimals) < 3:
precision = 2
if currency:
fraction = frappe.db.get_value("Currency", currency, "fraction_units") or 100
precision = len(cstr(fraction)) - 1
else:
precision = 2
elif len(decimals) < precision: elif len(decimals) < precision:
precision = len(decimals) precision = len(decimals)


@@ -781,7 +786,7 @@ def make_filter_tuple(doctype, key, value):
return [doctype, key, value[0], value[1]] return [doctype, key, value[0], value[1]]
else: else:
return [doctype, key, "=", value] return [doctype, key, "=", value]
def scrub_urls(html): def scrub_urls(html):
html = expand_relative_urls(html) html = expand_relative_urls(html)
# encoding should be responsibility of the composer # encoding should be responsibility of the composer


正在加载...
取消
保存