2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/server/index.js
2018-03-28 17:42:13 +05:30

35 lines
1.2 KiB
JavaScript

const server = require('frappejs/server');
const frappe = require('frappejs');
const GeneralLedger = require('../reports/generalLedger/GeneralLedger')
const naming = require('frappejs/model/naming')
module.exports = {
async start() {
await server.start({
backend: 'sqlite',
connectionParams: {dbPath: 'test.db'},
staticPath: './www',
models: require('../models')
})
// set server-side modules
frappe.models.Invoice.documentClass = require('../models/doctype/Invoice/InvoiceServer.js');
frappe.models.Payment.documentClass = require('../models/doctype/Payment/PaymentServer.js');
frappe.models.JournalEntry.documentClass = require('../models/doctype/JournalEntry/JournalEntryServer.js');
frappe.metaCache = {};
frappe.syncDoc(require('../fixtures/invoicePrint'));
// init naming series if missing
await naming.createNumberSeries('INV-', 'InvoiceSetting');
await naming.createNumberSeries('PAY-', 'PaymentSetting');
await naming.createNumberSeries('JV-', 'JournalEntrySetting');
frappe.registerMethod({
method: 'general-ledger',
handler: args => GeneralLedger(args)
});
}
}