Merge pull request #5786 from pratu16x7/float-precision

[formatters] add check for boot.sysdefaults, fixes frappe/erpnext#14796
This commit is contained in:
Prateeksha Singh 2018-07-06 10:29:14 +05:30 committed by GitHub
commit 4fc37a6cf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,9 @@ frappe.form.formatters = {
},
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;
var precision = docfield.precision
|| cint(frappe.boot.sysdefaults && 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;