2018-05-08 07:37:59 +00:00
|
|
|
const path = require('path');
|
2018-03-26 12:14:27 +00:00
|
|
|
const server = require('frappejs/server');
|
|
|
|
const frappe = require('frappejs');
|
2018-03-30 17:03:12 +00:00
|
|
|
const naming = require('frappejs/model/naming');
|
2018-04-28 14:53:30 +00:00
|
|
|
const registerReportMethods = require('../reports');
|
2018-03-26 12:14:27 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
async start() {
|
|
|
|
await server.start({
|
|
|
|
backend: 'sqlite',
|
2018-04-16 13:03:54 +00:00
|
|
|
connectionParams: { dbPath: 'test.db' },
|
2018-05-08 07:37:59 +00:00
|
|
|
staticPath: path.resolve(__dirname, '../www'),
|
2018-03-26 12:14:27 +00:00
|
|
|
models: require('../models')
|
|
|
|
})
|
|
|
|
|
2018-04-16 13:03:54 +00:00
|
|
|
await this.postStart();
|
|
|
|
},
|
|
|
|
|
|
|
|
async postStart() {
|
2018-03-26 12:14:27 +00:00
|
|
|
// set server-side modules
|
|
|
|
frappe.models.Invoice.documentClass = require('../models/doctype/Invoice/InvoiceServer.js');
|
2018-03-27 13:52:59 +00:00
|
|
|
frappe.models.Payment.documentClass = require('../models/doctype/Payment/PaymentServer.js');
|
2018-04-26 10:23:27 +00:00
|
|
|
frappe.models.Bill.documentClass = require('../models/doctype/Bill/BillServer.js');
|
|
|
|
frappe.models.JournalEntry.documentClass = require('../models/doctype/JournalEntry/JournalEntryServer.js');
|
2018-03-27 13:52:59 +00:00
|
|
|
|
2018-03-26 12:14:27 +00:00
|
|
|
frappe.metaCache = {};
|
|
|
|
|
|
|
|
frappe.syncDoc(require('../fixtures/invoicePrint'));
|
|
|
|
|
2018-03-27 13:52:59 +00:00
|
|
|
// init naming series if missing
|
2018-03-29 14:44:18 +00:00
|
|
|
await naming.createNumberSeries('INV-', 'InvoiceSettings');
|
2018-04-26 10:23:27 +00:00
|
|
|
await naming.createNumberSeries('BILL-', 'BillSettings');
|
2018-03-29 14:44:18 +00:00
|
|
|
await naming.createNumberSeries('PAY-', 'PaymentSettings');
|
2018-03-29 07:28:56 +00:00
|
|
|
await naming.createNumberSeries('JV-', 'JournalEntrySettings');
|
2018-03-29 08:23:27 +00:00
|
|
|
await naming.createNumberSeries('QTN-', 'QuotationSettings');
|
2018-04-28 14:26:26 +00:00
|
|
|
await naming.createNumberSeries('SO-', 'SalesOrderSettings');
|
|
|
|
await naming.createNumberSeries('OF-', 'FulfillmentSettings');
|
|
|
|
await naming.createNumberSeries('PO-', 'PurchaseOrderSettings');
|
|
|
|
await naming.createNumberSeries('PREC-', 'PurchaseReceiptSettings');
|
2018-03-27 13:52:59 +00:00
|
|
|
|
2018-04-19 14:31:35 +00:00
|
|
|
registerReportMethods();
|
2018-03-26 12:14:27 +00:00
|
|
|
}
|
|
|
|
}
|