2
0
mirror of https://github.com/frappe/books.git synced 2025-01-12 02:59:11 +00:00
books/patches/0.3.2/moveNumberSeriesFromSettings.js
2022-03-08 12:16:18 +05:30

17 lines
491 B
JavaScript

import { invertMap } from '@/utils';
import frappe from 'frappe';
import { DEFAULT_NUMBER_SERIES } from 'frappe/utils/consts';
async function setReferencesOnNumberSeries() {
const map = invertMap(DEFAULT_NUMBER_SERIES);
const rows = await frappe.db.knex('NumberSeries');
for (const row of rows) {
row.referenceType = map[row.name];
}
await frappe.db.prestigeTheTable('NumberSeries', rows);
}
export default async function execute() {
await setReferencesOnNumberSeries();
}