2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/fyo/models/SystemSettings.ts
18alantom 9877bf4fd3 incr: simplify doc a bit
- allow nulls in converter else not not null'll fail
2022-05-23 16:18:22 +05:30

20 lines
563 B
TypeScript

import { DocValue } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
import { ValidationMap } from 'fyo/model/types';
import { ValidationError } from 'fyo/utils/errors';
import { t } from 'fyo/utils/translation';
export default class SystemSettings extends Doc {
validations: ValidationMap = {
async displayPrecision(value: DocValue) {
if ((value as number) >= 0 && (value as number) <= 9) {
return;
}
throw new ValidationError(
t`Display Precision should have a value between 0 and 9.`
);
},
};
}