2022-03-08 06:46:18 +00:00
|
|
|
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) {
|
2022-03-08 08:47:37 +00:00
|
|
|
if (row.referenceType === map[row.name]) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-08 06:46:18 +00:00
|
|
|
row.referenceType = map[row.name];
|
|
|
|
}
|
|
|
|
await frappe.db.prestigeTheTable('NumberSeries', rows);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default async function execute() {
|
|
|
|
await setReferencesOnNumberSeries();
|
|
|
|
}
|