Hi All, Can any one please explain me the reason of formatting float field as currency when referenced by options? I am talking about the below code. Thanks
Float: function(value, docfield, options, doc) {
// don't allow 0 precision for Floats, hence or'ing with null
var precision = docfield.precision || cint(frappe.boot.sysdefaults.float_precision) || null;
if (docfield.options && docfield.options.trim()) {
// options points to a currency field, but expects precision of float!
docfield.precision = precision;
return frappe.form.formatters.Currency(value, docfield, options, doc);
} else {
// show 1.000000 as 1
if (!(options || {}).always_show_decimals && !is_null(value)) {
var temp = cstr(value).split(".");
if (temp[1]==undefined || cint(temp[1])===0) {
precision = 0;
}
}
return frappe.form.formatters._right(
((value==null || value==="")
? ""
: format_number(value, null, precision)), options);
}
}