diff --git a/frappe/backends/sqlite.js b/frappe/backends/sqlite.js index e9ab69ee..321699ca 100644 --- a/frappe/backends/sqlite.js +++ b/frappe/backends/sqlite.js @@ -30,8 +30,18 @@ class SqliteDatabase extends Database { // create temp table await this.createTable(doctype, tempName); - // copy from old to new table - await this.knex(tempName).insert(this.knex.select().from(doctype)); + try { + // copy from old to new table + await this.knex(tempName).insert(this.knex.select().from(doctype)); + } catch (err) { + + await this.sql('ROLLBACK'); + await this.sql('PRAGMA foreign_keys=ON'); + + const rows = await this.knex.select().from(doctype); + await this.prestigeTheTable(doctype, rows); + return; + } // drop old table await this.knex.schema.dropTable(doctype); @@ -110,6 +120,7 @@ class SqliteDatabase extends Database { // Alter table hacx for sqlite in case of schema change. const tempName = `__${tableName}`; await this.knex.schema.dropTableIfExists(tempName); + await this.knex.raw('PRAGMA foreign_keys=OFF'); await this.createTable(tableName, tempName); diff --git a/frappe/model/naming.js b/frappe/model/naming.js index dd42d85d..86fd62d0 100644 --- a/frappe/model/naming.js +++ b/frappe/model/naming.js @@ -1,3 +1,4 @@ +const { getPaddedName } = require('@/utils'); const frappe = require('frappe'); const { getRandomString } = require('frappe/utils'); @@ -28,11 +29,23 @@ module.exports = { return; } + // Current, per doc number series + if (doc.numberSeries) { + doc.name = await this.getSeriesNext(doc.numberSeries, doc.doctype); + return; + } + + // if(doc.meta) + + // Legacy, using doc settings for number series if (doc.meta.settings) { const numberSeries = (await doc.getSettings()).numberSeries; - if (numberSeries) { - doc.name = await this.getSeriesNext(numberSeries, doc.doctype); + if (!numberSeries) { + return; } + + doc.name = await this.getSeriesNext(numberSeries, doc.doctype); + return; } } @@ -78,33 +91,34 @@ module.exports = { async getSeriesNext(prefix, doctype) { let series; + try { series = await frappe.getDoc('NumberSeries', prefix); } catch (e) { if (!e.statusCode || e.statusCode !== 404) { throw e; } - await this.createNumberSeries(prefix); + + await this.createNumberSeries(prefix, doctype); series = await frappe.getDoc('NumberSeries', prefix); } - let next = await series.next(doctype); - return prefix + next; + + return await series.next(doctype); }, - async createNumberSeries(prefix, setting, start = 1001) { - if (!(await frappe.db.exists('NumberSeries', prefix))) { - const series = frappe.newDoc({ - doctype: 'NumberSeries', - name: prefix, - current: start, - }); - await series.insert(); - - if (setting) { - const settingDoc = await frappe.getSingle(setting); - settingDoc.numberSeries = series.name; - await settingDoc.update(); - } + async createNumberSeries(prefix, referenceType, start = 1001) { + const exists = await frappe.db.exists('NumberSeries', prefix); + if (exists) { + return; } + + const series = frappe.newDoc({ + doctype: 'NumberSeries', + name: prefix, + start, + referenceType, + }); + + await series.insert(); }, }; diff --git a/frappe/models/doctype/NumberSeries/NumberSeries.js b/frappe/models/doctype/NumberSeries/NumberSeries.js index 379e48ad..9ae22a21 100644 --- a/frappe/models/doctype/NumberSeries/NumberSeries.js +++ b/frappe/models/doctype/NumberSeries/NumberSeries.js @@ -1,5 +1,18 @@ const { t } = require('frappe'); +const referenceTypeMap = { + SalesInvoice: t`Invoice`, + PurchaseInvoice: t`Bill`, + Payment: t`Payment`, + JournalEntry: t`Journal Entry`, + Quotation: t`Quotation`, + SalesOrder: t`SalesOrder`, + Fulfillment: t`Fulfillment`, + PurchaseOrder: t`PurchaseOrder`, + PurchaseReceipt: t`PurchaseReceipt`, + '-': t`None`, +}; + module.exports = { name: 'NumberSeries', documentClass: require('./NumberSeriesDocument.js'), @@ -14,11 +27,38 @@ module.exports = { fieldtype: 'Data', required: 1, }, + { + fieldname: 'start', + label: t`Start`, + fieldtype: 'Int', + default: 1001, + required: 1, + minvalue: 0, + }, + { + fieldname: 'padZeros', + label: t`Pad Zeros`, + fieldtype: 'Int', + default: 4, + required: 1, + }, + { + fieldname: 'referenceType', + label: t`Reference Type`, + fieldtype: 'Select', + options: Object.keys(referenceTypeMap), + map: referenceTypeMap, + default: '-', + required: 1, + readOnly: 1, + }, { fieldname: 'current', label: t`Current`, fieldtype: 'Int', required: 1, + readOnly: 1, }, ], + quickEditFields: ['start', 'padZeros', 'referenceType'], }; diff --git a/frappe/models/doctype/NumberSeries/NumberSeriesDocument.js b/frappe/models/doctype/NumberSeries/NumberSeriesDocument.js index 62b18789..4effd328 100644 --- a/frappe/models/doctype/NumberSeries/NumberSeriesDocument.js +++ b/frappe/models/doctype/NumberSeries/NumberSeriesDocument.js @@ -1,12 +1,14 @@ +const { getPaddedName } = require('@/utils'); const frappe = require('frappe'); const BaseDocument = require('frappe/model/document'); module.exports = class NumberSeries extends BaseDocument { validate() { - if (this.current === null || this.current === undefined) { - this.current = 0; + if (!this.current) { + this.current = this.start; } } + async next(doctype) { this.validate(); @@ -17,13 +19,19 @@ module.exports = class NumberSeries extends BaseDocument { this.current++; await this.update(); - return this.current; + return this.getPaddedName(this.current); } async checkIfCurrentExists(doctype) { if (!doctype) { return true; } - return await frappe.db.exists(doctype, this.name + this.current); + + const name = this.getPaddedName(this.current); + return await frappe.db.exists(doctype, name); + } + + getPaddedName(next) { + return getPaddedName(this.name, next, this.padZeros); } }; diff --git a/frappe/utils/consts.js b/frappe/utils/consts.js index 7b30b826..88e741fa 100644 --- a/frappe/utils/consts.js +++ b/frappe/utils/consts.js @@ -1,4 +1,15 @@ export const DEFAULT_INTERNAL_PRECISION = 11; export const DEFAULT_DISPLAY_PRECISION = 2; export const DEFAULT_LOCALE = 'en-IN'; -export const DEFAULT_LANGUAGE = 'English'; \ No newline at end of file +export const DEFAULT_LANGUAGE = 'English'; +export const DEFAULT_NUMBER_SERIES = { + SalesInvoice: 'SINV-', + PurchaseInvoice: 'PINV-', + Payment: 'PAY-', + JournalEntry: 'JV-', + Quotation: 'QTN-', + SalesOrder: 'SO-', + Fulfillment: 'OF-', + PurchaseOrder: 'PO-', + PurchaseReceipt: 'PREC-', +}; diff --git a/models/doctype/Fulfillment/Fulfillment.js b/models/doctype/Fulfillment/Fulfillment.js index 6a6ebe40..7fbb7ec2 100644 --- a/models/doctype/Fulfillment/Fulfillment.js +++ b/models/doctype/Fulfillment/Fulfillment.js @@ -1,5 +1,6 @@ import { t } from 'frappe'; import model from 'frappe/model'; +import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts'; import Quotation from '../Quotation/Quotation'; export default model.extend(Quotation, { @@ -11,5 +12,16 @@ export default model.extend(Quotation, { fieldname: 'items', childtype: 'FulfillmentItem', }, + { + fieldname: 'numberSeries', + label: t`Number Series`, + fieldtype: 'Link', + target: 'NumberSeries', + required: 1, + getFilters: () => { + return { referenceType: 'Fulfillment' }; + }, + default: DEFAULT_NUMBER_SERIES['FulFillment'], + }, ], }); diff --git a/models/doctype/FulfillmentSettings/FulfillmentSettings.js b/models/doctype/FulfillmentSettings/FulfillmentSettings.js index fe43a775..a752bb7c 100644 --- a/models/doctype/FulfillmentSettings/FulfillmentSettings.js +++ b/models/doctype/FulfillmentSettings/FulfillmentSettings.js @@ -5,10 +5,5 @@ import QuotationSettings from '../QuotationSettings/QuotationSettings'; export default model.extend(QuotationSettings, { name: 'FulfillmentSettings', label: t`Fulfillment Settings`, - fields: [ - { - fieldname: 'numberSeries', - default: 'OF', - }, - ], + fields: [], }); diff --git a/models/doctype/JournalEntry/JournalEntry.js b/models/doctype/JournalEntry/JournalEntry.js index 07f8d482..e7302113 100644 --- a/models/doctype/JournalEntry/JournalEntry.js +++ b/models/doctype/JournalEntry/JournalEntry.js @@ -1,6 +1,7 @@ import { t } from 'frappe'; import { DateTime } from 'luxon'; import { ledgerLink } from '../../../accounting/utils'; +import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts'; export default { label: t`Journal Entry`, @@ -72,6 +73,17 @@ export default { default: 0, readOnly: 1, }, + { + fieldname: 'numberSeries', + label: t`Number Series`, + fieldtype: 'Link', + target: 'NumberSeries', + required: 1, + getFilters: () => { + return { referenceType: 'JournalEntry' }; + }, + default: DEFAULT_NUMBER_SERIES['JournalEntry'], + }, ], actions: [ledgerLink], }; diff --git a/models/doctype/JournalEntrySettings/JournalEntrySettings.js b/models/doctype/JournalEntrySettings/JournalEntrySettings.js index 3c211483..36f0ec3e 100644 --- a/models/doctype/JournalEntrySettings/JournalEntrySettings.js +++ b/models/doctype/JournalEntrySettings/JournalEntrySettings.js @@ -6,14 +6,5 @@ export default { isSingle: 1, isChild: 0, keywordFields: [], - fields: [ - { - fieldname: 'numberSeries', - label: t`Number Series`, - fieldtype: 'Link', - target: 'NumberSeries', - required: 1, - default: 'JV', - }, - ], + fields: [], }; diff --git a/models/doctype/Payment/Payment.js b/models/doctype/Payment/Payment.js index dcb8eee4..c376c585 100644 --- a/models/doctype/Payment/Payment.js +++ b/models/doctype/Payment/Payment.js @@ -1,5 +1,6 @@ import frappe, { t } from 'frappe'; import utils from '../../../accounting/utils'; +import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts'; export default { name: 'Payment', @@ -81,6 +82,17 @@ export default { } }, }, + { + fieldname: 'numberSeries', + label: t`Number Series`, + fieldtype: 'Link', + target: 'NumberSeries', + required: 1, + getFilters: () => { + return { referenceType: 'Payment' }; + }, + default: DEFAULT_NUMBER_SERIES['Payment'], + }, { fieldname: 'paymentMethod', label: t`Payment Method`, @@ -162,6 +174,7 @@ export default { ], quickEditFields: [ + 'numberSeries', 'party', 'date', 'paymentMethod', diff --git a/models/doctype/PaymentSettings/PaymentSettings.js b/models/doctype/PaymentSettings/PaymentSettings.js index d088fd82..c71a9199 100644 --- a/models/doctype/PaymentSettings/PaymentSettings.js +++ b/models/doctype/PaymentSettings/PaymentSettings.js @@ -6,14 +6,5 @@ export default { isSingle: 1, isChild: 0, keywordFields: [], - fields: [ - { - fieldname: 'numberSeries', - label: t`Number Series`, - fieldtype: 'Link', - target: 'NumberSeries', - required: 1, - default: 'PAY', - }, - ], + fields: [], }; diff --git a/models/doctype/PurchaseInvoice/PurchaseInvoice.js b/models/doctype/PurchaseInvoice/PurchaseInvoice.js index 34c9c17a..c67832e7 100644 --- a/models/doctype/PurchaseInvoice/PurchaseInvoice.js +++ b/models/doctype/PurchaseInvoice/PurchaseInvoice.js @@ -1,4 +1,5 @@ import { t } from 'frappe'; +import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts'; import InvoiceTemplate from '../SalesInvoice/InvoiceTemplate.vue'; import { getActions } from '../Transaction/Transaction'; import PurchaseInvoice from './PurchaseInvoiceDocument'; @@ -134,6 +135,17 @@ export default { default: 0, readOnly: 1, }, + { + fieldname: 'numberSeries', + label: t`Number Series`, + fieldtype: 'Link', + target: 'NumberSeries', + required: 1, + getFilters: () => { + return { referenceType: 'PurchaseInvoice' }; + }, + default: DEFAULT_NUMBER_SERIES['PurchaseInvoice'], + }, ], actions: getActions('PurchaseInvoice'), diff --git a/models/doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js b/models/doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js index fa668e6f..6ff16278 100644 --- a/models/doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js +++ b/models/doctype/PurchaseInvoiceSettings/PurchaseInvoiceSettings.js @@ -6,14 +6,5 @@ export default { isSingle: 1, isChild: 0, keywordFields: [], - fields: [ - { - fieldname: 'numberSeries', - label: t`Number Series`, - fieldtype: 'Link', - target: 'NumberSeries', - required: 1, - default: 'PINV', - }, - ], + fields: [], }; diff --git a/models/doctype/PurchaseOrder/PurchaseOrder.js b/models/doctype/PurchaseOrder/PurchaseOrder.js index 15f54151..a47960d9 100644 --- a/models/doctype/PurchaseOrder/PurchaseOrder.js +++ b/models/doctype/PurchaseOrder/PurchaseOrder.js @@ -1,5 +1,6 @@ import { t } from 'frappe'; import model from 'frappe/model'; +import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts'; import PurchaseInvoice from '../PurchaseInvoice/PurchaseInvoice'; export default model.extend( @@ -13,6 +14,17 @@ export default model.extend( fieldname: 'items', childtype: 'PurchaseOrderItem', }, + { + fieldname: 'numberSeries', + label: t`Number Series`, + fieldtype: 'Link', + target: 'NumberSeries', + required: 1, + getFilters: () => { + return { referenceType: 'PurchaseOrder' }; + }, + default: DEFAULT_NUMBER_SERIES['PurchaseOrder'], + }, ], }, { diff --git a/models/doctype/PurchaseOrderSettings/PurchaseOrderSettings.js b/models/doctype/PurchaseOrderSettings/PurchaseOrderSettings.js index 737da861..4aab3f3d 100644 --- a/models/doctype/PurchaseOrderSettings/PurchaseOrderSettings.js +++ b/models/doctype/PurchaseOrderSettings/PurchaseOrderSettings.js @@ -5,10 +5,5 @@ import PurchaseInvoiceSettings from '../PurchaseInvoiceSettings/PurchaseInvoiceS export default model.extend(PurchaseInvoiceSettings, { name: 'PurchaseOrderSettings', label: t`Purchase Order Settings`, - fields: [ - { - fieldname: 'numberSeries', - default: 'PO', - }, - ], + fields: [], }); diff --git a/models/doctype/PurchaseReceipt/PurchaseReceipt.js b/models/doctype/PurchaseReceipt/PurchaseReceipt.js index 984d9455..d3c31ee7 100644 --- a/models/doctype/PurchaseReceipt/PurchaseReceipt.js +++ b/models/doctype/PurchaseReceipt/PurchaseReceipt.js @@ -1,5 +1,6 @@ import { t } from 'frappe'; import model from 'frappe/model'; +import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts'; import PurchaseOrder from '../PurchaseOrder/PurchaseOrder'; export default model.extend(PurchaseOrder, { @@ -11,5 +12,16 @@ export default model.extend(PurchaseOrder, { fieldname: 'items', childtype: 'PurchaseReceiptItem', }, + { + fieldname: 'numberSeries', + label: t`Number Series`, + fieldtype: 'Link', + target: 'NumberSeries', + required: 1, + getFilters: () => { + return { referenceType: 'PurchaseReceipt' }; + }, + default: DEFAULT_NUMBER_SERIES['PurchaseReceipt'], + }, ], }); diff --git a/models/doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js b/models/doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js index b5c2da4b..b2c441c2 100644 --- a/models/doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js +++ b/models/doctype/PurchaseReceiptSettings/PurchaseReceiptSettings.js @@ -5,10 +5,5 @@ import PurchaseOrderSettings from '../PurchaseOrderSettings/PurchaseOrderSetting export default model.extend(PurchaseOrderSettings, { name: 'PurchaseReceiptSettings', label: t`Purchase Receipt Settings`, - fields: [ - { - fieldname: 'numberSeries', - default: 'PREC', - }, - ], + fields: [], }); diff --git a/models/doctype/Quotation/Quotation.js b/models/doctype/Quotation/Quotation.js index cf506b61..d2401a63 100644 --- a/models/doctype/Quotation/Quotation.js +++ b/models/doctype/Quotation/Quotation.js @@ -1,5 +1,6 @@ import { t } from 'frappe'; import model from 'frappe/model'; +import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts'; import SalesInvoice from '../SalesInvoice/SalesInvoice'; const Quotation = model.extend( @@ -13,6 +14,17 @@ const Quotation = model.extend( fieldname: 'items', childtype: 'QuotationItem', }, + { + fieldname: 'numberSeries', + label: t`Number Series`, + fieldtype: 'Link', + target: 'NumberSeries', + required: 1, + getFilters: () => { + return { referenceType: 'Quotation' }; + }, + default: DEFAULT_NUMBER_SERIES['Quotation'], + }, ], links: [], }, diff --git a/models/doctype/QuotationSettings/QuotationSettings.js b/models/doctype/QuotationSettings/QuotationSettings.js index d28c0c32..2128dbf1 100644 --- a/models/doctype/QuotationSettings/QuotationSettings.js +++ b/models/doctype/QuotationSettings/QuotationSettings.js @@ -5,10 +5,5 @@ import SalesInvoiceSettings from '../SalesInvoiceSettings/SalesInvoiceSettings'; export default model.extend(SalesInvoiceSettings, { name: 'QuotationSettings', label: t`Quotation Settings`, - fields: [ - { - fieldname: 'numberSeries', - default: 'QTN', - }, - ], + fields: [], }); diff --git a/models/doctype/SalesInvoice/SalesInvoice.js b/models/doctype/SalesInvoice/SalesInvoice.js index 072c19e5..91318cbf 100644 --- a/models/doctype/SalesInvoice/SalesInvoice.js +++ b/models/doctype/SalesInvoice/SalesInvoice.js @@ -1,4 +1,5 @@ import { t } from 'frappe'; +import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts'; import { getActions } from '../Transaction/Transaction'; import InvoiceTemplate from './InvoiceTemplate.vue'; import SalesInvoice from './SalesInvoiceDocument'; @@ -134,6 +135,17 @@ export default { default: 0, readOnly: 1, }, + { + fieldname: 'numberSeries', + label: t`Number Series`, + fieldtype: 'Link', + target: 'NumberSeries', + required: 1, + getFilters: () => { + return { referenceType: 'SalesInvoice' }; + }, + default: DEFAULT_NUMBER_SERIES['SalesInvoice'], + }, ], actions: getActions('SalesInvoice'), diff --git a/models/doctype/SalesInvoiceSettings/SalesInvoiceSettings.js b/models/doctype/SalesInvoiceSettings/SalesInvoiceSettings.js index 7966fc77..e6606d45 100644 --- a/models/doctype/SalesInvoiceSettings/SalesInvoiceSettings.js +++ b/models/doctype/SalesInvoiceSettings/SalesInvoiceSettings.js @@ -7,14 +7,6 @@ export default { isChild: 0, keywordFields: [], fields: [ - { - fieldname: 'numberSeries', - label: t`Number Series`, - fieldtype: 'Link', - target: 'NumberSeries', - required: 1, - default: 'SINV', - }, { fieldname: 'template', label: t`Template`, diff --git a/models/doctype/SalesOrder/SalesOrder.js b/models/doctype/SalesOrder/SalesOrder.js index 551e8433..b8ed2eb6 100644 --- a/models/doctype/SalesOrder/SalesOrder.js +++ b/models/doctype/SalesOrder/SalesOrder.js @@ -1,5 +1,6 @@ import { t } from 'frappe'; import model from 'frappe/model'; +import { DEFAULT_NUMBER_SERIES } from '../../../frappe/utils/consts'; import Quotation from '../Quotation/Quotation'; export default model.extend(Quotation, { @@ -11,5 +12,16 @@ export default model.extend(Quotation, { fieldname: 'items', childtype: 'SalesOrderItem', }, + { + fieldname: 'numberSeries', + label: t`Number Series`, + fieldtype: 'Link', + target: 'NumberSeries', + required: 1, + getFilters: () => { + return { referenceType: 'SalesOrder' }; + }, + default: DEFAULT_NUMBER_SERIES['SalesOrder'], + }, ], }); diff --git a/models/doctype/SalesOrderSettings/SalesOrderSettings.js b/models/doctype/SalesOrderSettings/SalesOrderSettings.js index 4c683491..755f2c91 100644 --- a/models/doctype/SalesOrderSettings/SalesOrderSettings.js +++ b/models/doctype/SalesOrderSettings/SalesOrderSettings.js @@ -5,10 +5,5 @@ import QuotationSettings from '../QuotationSettings/QuotationSettings'; export default model.extend(QuotationSettings, { name: 'SalesOrderSettings', label: t`Sales Order Settings`, - fields: [ - { - fieldname: 'numberSeries', - default: 'SO', - }, - ], + fields: [], }); diff --git a/patches/0.3.2/moveNumberSeriesFromSettings.js b/patches/0.3.2/moveNumberSeriesFromSettings.js new file mode 100644 index 00000000..def267df --- /dev/null +++ b/patches/0.3.2/moveNumberSeriesFromSettings.js @@ -0,0 +1,20 @@ +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(); +} diff --git a/patches/patches.json b/patches/patches.json index e450d707..27a912ad 100644 --- a/patches/patches.json +++ b/patches/patches.json @@ -8,5 +8,10 @@ "version": "0.0.4", "fileName": "convertCurrencyToStrings", "beforeMigrate": true + }, + { + "version": "0.3.2", + "fileName": "moveNumberSeriesFromSettings", + "beforeMigrate": false } ] diff --git a/server/postStart.js b/server/postStart.js index 3c7a9907..5c98aa53 100644 --- a/server/postStart.js +++ b/server/postStart.js @@ -20,15 +20,15 @@ export default async function postStart() { frappe.metaCache = {}; // init naming series if missing - await naming.createNumberSeries('SINV-', 'SalesInvoiceSettings'); - await naming.createNumberSeries('PINV-', 'PurchaseInvoiceSettings'); - await naming.createNumberSeries('PAY-', 'PaymentSettings'); - await naming.createNumberSeries('JV-', 'JournalEntrySettings'); - await naming.createNumberSeries('QTN-', 'QuotationSettings'); - await naming.createNumberSeries('SO-', 'SalesOrderSettings'); - await naming.createNumberSeries('OF-', 'FulfillmentSettings'); - await naming.createNumberSeries('PO-', 'PurchaseOrderSettings'); - await naming.createNumberSeries('PREC-', 'PurchaseReceiptSettings'); + await naming.createNumberSeries('SINV-', 'SalesInvoice'); + await naming.createNumberSeries('PINV-', 'PurchaseInvoice'); + await naming.createNumberSeries('PAY-', 'Payment'); + await naming.createNumberSeries('JV-', 'JournalEntry'); + // await naming.createNumberSeries('QTN-', 'QuotationSettings'); + // await naming.createNumberSeries('SO-', 'SalesOrderSettings'); + // await naming.createNumberSeries('OF-', 'FulfillmentSettings'); + // await naming.createNumberSeries('PO-', 'PurchaseOrderSettings'); + // await naming.createNumberSeries('PREC-', 'PurchaseReceiptSettings'); // fetch singles // so that they are available synchronously diff --git a/src/components/Controls/Link.vue b/src/components/Controls/Link.vue index 48062836..b9203848 100644 --- a/src/components/Controls/Link.vue +++ b/src/components/Controls/Link.vue @@ -1,10 +1,9 @@