mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { Doc } from 'fyo/model/doc';
|
|
import { FiltersMap } from 'fyo/model/types';
|
|
import { ModelNameEnum } from 'models/types';
|
|
|
|
export class Defaults extends Doc {
|
|
salesInvoiceNumberSeries?: string;
|
|
purchaseInvoiceNumberSeries?: string;
|
|
journalEntryNumberSeries?: string;
|
|
paymentNumberSeries?: string;
|
|
|
|
salesInvoiceTerms?: string;
|
|
purchaseInvoiceTerms?: string;
|
|
|
|
static filters: FiltersMap = {
|
|
salesInvoiceNumberSeries: () => ({
|
|
referenceType: ModelNameEnum.SalesInvoice,
|
|
}),
|
|
purchaseInvoiceNumberSeries: () => ({
|
|
referenceType: ModelNameEnum.PurchaseInvoice,
|
|
}),
|
|
journalEntryNumberSeries: () => ({
|
|
referenceType: ModelNameEnum.JournalEntry,
|
|
}),
|
|
paymentNumberSeries: () => ({ referenceType: ModelNameEnum.Payment }),
|
|
};
|
|
|
|
static createFilters: FiltersMap = {
|
|
salesInvoiceNumberSeries: () => ({
|
|
referenceType: ModelNameEnum.SalesInvoice,
|
|
}),
|
|
purchaseInvoiceNumberSeries: () => ({
|
|
referenceType: ModelNameEnum.PurchaseInvoice,
|
|
}),
|
|
journalEntryNumberSeries: () => ({
|
|
referenceType: ModelNameEnum.JournalEntry,
|
|
}),
|
|
paymentNumberSeries: () => ({
|
|
referenceType: ModelNameEnum.Payment,
|
|
}),
|
|
};
|
|
}
|
|
|
|
export const numberSeriesDefaultsMap: Record<
|
|
string,
|
|
keyof Defaults | undefined
|
|
> = {
|
|
[ModelNameEnum.SalesInvoice]: 'salesInvoiceNumberSeries',
|
|
[ModelNameEnum.PurchaseInvoice]: 'purchaseInvoiceNumberSeries',
|
|
[ModelNameEnum.JournalEntry]: 'journalEntryNumberSeries',
|
|
[ModelNameEnum.Payment]: 'paymentNumberSeries',
|
|
};
|