2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/models/inventory/InventorySettings.ts
18alantom 9646580b38 incr: make flags readonly once set
- remove redundant validation
2023-02-27 18:44:50 +05:30

43 lines
1.1 KiB
TypeScript

import { Doc } from 'fyo/model/doc';
import { FiltersMap, ReadOnlyMap } from 'fyo/model/types';
import { AccountTypeEnum } from 'models/baseModels/Account/types';
import { ValuationMethod } from './types';
export class InventorySettings extends Doc {
defaultLocation?: string;
stockInHand?: string;
valuationMethod?: ValuationMethod;
stockReceivedButNotBilled?: string;
costOfGoodsSold?: string;
enableBarcodes?: boolean;
enableBatches?: boolean;
enableUomConversions?: boolean;
static filters: FiltersMap = {
stockInHand: () => ({
isGroup: false,
accountType: AccountTypeEnum.Stock,
}),
stockReceivedButNotBilled: () => ({
isGroup: false,
accountType: AccountTypeEnum['Stock Received But Not Billed'],
}),
costOfGoodsSold: () => ({
isGroup: false,
accountType: AccountTypeEnum['Cost of Goods Sold'],
}),
};
readOnly: ReadOnlyMap = {
enableBarcodes: () => {
return !!this.enableBarcodes;
},
enableBatches: () => {
return !!this.enableBatches;
},
enableUomConversions: () => {
return !!this.enableUomConversions;
},
};
}