2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/models/baseModels/AccountingSettings/AccountingSettings.ts
18alantom 7f928ca712 incr: add a few calculations
- add enableDiscounting
- add toggle between amount and percent
- minor ui fixes
2022-07-13 23:18:20 +05:30

37 lines
759 B
TypeScript

import { Doc } from 'fyo/model/doc';
import {
FiltersMap,
ListsMap,
ReadOnlyMap,
ValidationMap,
} from 'fyo/model/types';
import { validateEmail } from 'fyo/model/validationFunction';
import { getCountryInfo } from 'utils/misc';
export class AccountingSettings extends Doc {
static filters: FiltersMap = {
writeOffAccount: () => ({
isGroup: false,
rootType: 'Expense',
}),
roundOffAccount: () => ({
isGroup: false,
rootType: 'Expense',
}),
};
validations: ValidationMap = {
email: validateEmail,
};
static lists: ListsMap = {
country: () => Object.keys(getCountryInfo()),
};
readOnly: ReadOnlyMap = {
enableDiscounting: () => {
return !!this.enableDiscounting;
},
};
}