mirror of
https://github.com/frappe/books.git
synced 2025-01-11 10:38:14 +00:00
fix: deprecate floatPrecision add displayPrecision
This commit is contained in:
parent
3610f79732
commit
8bf257c685
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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',
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user