diff --git a/model/document.js b/model/document.js index ccf8a032..88c158b7 100644 --- a/model/document.js +++ b/model/document.js @@ -673,7 +673,7 @@ module.exports = class BaseDocument extends Observable { if (typeof df === 'string') { df = this.meta.getField(df); } - let systemPrecision = frappe.SystemSettings.floatPrecision; + let systemPrecision = frappe.SystemSettings.internalPrecision; let defaultPrecision = systemPrecision != null ? systemPrecision : 2; let precision = df && df.precision != null ? df.precision : defaultPrecision; diff --git a/model/meta.js b/model/meta.js index fa6973ea..6107219d 100644 --- a/model/meta.js +++ b/model/meta.js @@ -51,7 +51,7 @@ module.exports = class BaseMeta extends BaseDocument { // attach default precision to Float and Currency if (['Float', 'Currency'].includes(df.fieldtype)) { let defaultPrecision = frappe.SystemSettings - ? frappe.SystemSettings.floatPrecision + ? frappe.SystemSettings.internalPrecision : 2; df.precision = df.precision || defaultPrecision; } diff --git a/models/doctype/SystemSettings/SystemSettings.js b/models/doctype/SystemSettings/SystemSettings.js index ac68075e..92396cfe 100644 --- a/models/doctype/SystemSettings/SystemSettings.js +++ b/models/doctype/SystemSettings/SystemSettings.js @@ -40,12 +40,21 @@ module.exports = { description: _('Sets the app-wide date display format.'), }, { - fieldname: 'floatPrecision', - label: 'Precision', - fieldtype: 'Select', - options: ['2', '3', '4', '5'], - default: '2', + fieldname: 'displayPrecision', + label: 'Display Precision', + fieldtype: 'Int', + default: 2, required: 1, + minValue: 0, + maxValue: 9, + validate(value, doc) { + if (value >= 0 && value <= 9) { + return; + } + throw new frappe.errors.ValidationError( + _('Display Precision should have a value between 0 and 9.') + ); + }, description: _('Sets how many digits are shown after the decimal point.'), }, { @@ -78,7 +87,7 @@ module.exports = { ], quickEditFields: [ 'dateFormat', - 'floatPrecision', + 'displayPrecision', 'hideGetStarted', 'autoUpdate', ],