mirror of
https://github.com/frappe/books.git
synced 2024-11-13 00:46:28 +00:00
21 lines
559 B
JavaScript
21 lines
559 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) {
|
|
if (row.referenceType === map[row.name]) {
|
|
return;
|
|
}
|
|
|
|
row.referenceType = map[row.name];
|
|
}
|
|
await frappe.db.prestigeTheTable('NumberSeries', rows);
|
|
}
|
|
|
|
export default async function execute() {
|
|
await setReferencesOnNumberSeries();
|
|
}
|