2
0
mirror of https://github.com/frappe/books.git synced 2025-01-25 16:18:33 +00:00
books/server/index.js

41 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-04-18 12:17:00 +05:30
global.rootRequire = function(name) {
return require(process.cwd() + '/' + name);
}
2018-03-26 17:44:27 +05:30
const server = require('frappejs/server');
const frappe = require('frappejs');
const naming = require('frappejs/model/naming');
2018-04-19 20:01:35 +05:30
const { registerReportMethods } = require('../reports');
2018-03-26 17:44:27 +05:30
module.exports = {
async start() {
await server.start({
backend: 'sqlite',
2018-04-16 18:33:54 +05:30
connectionParams: { dbPath: 'test.db' },
2018-03-26 17:44:27 +05:30
staticPath: './www',
models: require('../models')
})
2018-04-16 18:33:54 +05:30
await this.postStart();
},
async postStart() {
2018-03-26 17:44:27 +05:30
// set server-side modules
frappe.models.Invoice.documentClass = require('../models/doctype/Invoice/InvoiceServer.js');
2018-03-27 19:22:59 +05:30
frappe.models.Payment.documentClass = require('../models/doctype/Payment/PaymentServer.js');
2018-04-18 14:32:05 +05:30
// frappe.models.JournalEntry.documentClass = require('../models/doctype/JournalEntry/JournalEntryServer.js');
2018-03-27 19:22:59 +05:30
2018-03-26 17:44:27 +05:30
frappe.metaCache = {};
frappe.syncDoc(require('../fixtures/invoicePrint'));
2018-03-27 19:22:59 +05:30
// init naming series if missing
2018-03-29 20:14:18 +05:30
await naming.createNumberSeries('INV-', 'InvoiceSettings');
await naming.createNumberSeries('PAY-', 'PaymentSettings');
await naming.createNumberSeries('JV-', 'JournalEntrySettings');
2018-03-29 13:53:27 +05:30
await naming.createNumberSeries('QTN-', 'QuotationSettings');
2018-03-27 19:22:59 +05:30
2018-04-19 20:01:35 +05:30
registerReportMethods();
2018-03-26 17:44:27 +05:30
}
}