def get_currency_precision(): company_currency = webnotes.conn.get_value("Company", webnotes.conn.get_default("company"), "default_currency") currency_format = webnotes.conn.get_value("Currency", company_currency, "number_format") from webnotes.utils import get_number_format_info return get_number_format_info(currency_format)[2]
def get_currency_precision(): company_currency = webnotes.conn.get_value( "Company", webnotes.conn.get_default("company"), "default_currency") currency_format = webnotes.conn.get_value("Currency", company_currency, "number_format") from webnotes.utils import get_number_format_info return get_number_format_info(currency_format)[2]
def get_field_precision(df, doc): """get precision based on DocField options and fieldvalue in doc""" from webnotes.utils import get_number_format_info number_format = None if df.fieldtype == "Currency": currency = get_field_currency(df, doc) if currency: number_format = webnotes.conn.get_value("Currency", currency, "number_format") if not number_format: number_format = webnotes.conn.get_default("number_format") or "#,###.##" decimal_str, comma_str, precision = get_number_format_info(number_format) if df.fieldtype == "Float": precision = cint(webnotes.conn.get_default("float_precision")) or 3 return precision
def get_field_precision(df, doc): """get precision based on DocField options and fieldvalue in doc""" from webnotes.utils import get_number_format_info number_format = None if df.fieldtype == "Currency": currency = get_field_currency(df, doc) if currency: number_format = webnotes.conn.get_value("Currency", currency, "number_format") if not number_format: number_format = webnotes.conn.get_default("number_format") or "#,###.##" decimal_str, comma_str, precision = get_number_format_info(number_format) if df.fieldtype == "Float": precision = cint(webnotes.conn.get_default("float_precision")) or 3 return precision