mirror of
https://github.com/frappe/books.git
synced 2024-11-14 01:14:03 +00:00
40 lines
708 B
TypeScript
40 lines
708 B
TypeScript
import { ModelNameEnum } from '../../models/types';
|
|
import { DatabaseManager } from '../database/manager';
|
|
import { getDefaultMetaFieldValueMap } from '../helpers';
|
|
|
|
const defaultUOMs = [
|
|
{
|
|
name: `Unit`,
|
|
isWhole: true,
|
|
},
|
|
{
|
|
name: `Kg`,
|
|
isWhole: false,
|
|
},
|
|
{
|
|
name: `Gram`,
|
|
isWhole: false,
|
|
},
|
|
{
|
|
name: `Meter`,
|
|
isWhole: false,
|
|
},
|
|
{
|
|
name: `Hour`,
|
|
isWhole: false,
|
|
},
|
|
{
|
|
name: `Day`,
|
|
isWhole: false,
|
|
},
|
|
];
|
|
|
|
async function execute(dm: DatabaseManager) {
|
|
for (const uom of defaultUOMs) {
|
|
const defaults = getDefaultMetaFieldValueMap();
|
|
await dm.db?.insert(ModelNameEnum.UOM, { ...uom, ...defaults });
|
|
}
|
|
}
|
|
|
|
export default { execute };
|