[fix] Use df.precision if specified

This commit is contained in:
Anand Doshi 2014-12-23 14:54:35 +05:30
parent b3042546b1
commit ab286a89be

View file

@ -258,9 +258,10 @@ def get_field_precision(df, doc):
"""get precision based on DocField options and fieldvalue in doc"""
from frappe.utils import get_number_format_info
precision = cint(df.precision) or cint(frappe.db.get_default("float_precision")) or 3
if cint(df.precision):
precision = cint(df.precision)
if df.fieldtype == "Currency":
elif df.fieldtype == "Currency":
number_format = None
currency = get_field_currency(df, doc)
@ -276,6 +277,9 @@ def get_field_precision(df, doc):
decimal_str, comma_str, precision = get_number_format_info(number_format)
else:
precision = cint(frappe.db.get_default("float_precision")) or 3
return precision
def clear_cache(doctype=None):