2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/server/index.js
Faris Ansari 17e5187c51 Reports and Models
- Models
  - Bill
  - Quotation (extended from Invoice)
  - Journal Entry

- Reports
  - Sales Register
  - Purchase Register
2018-04-26 15:53:27 +05:30

43 lines
1.5 KiB
JavaScript

global.rootRequire = function(name) {
return require(process.cwd() + '/' + name);
}
const server = require('frappejs/server');
const frappe = require('frappejs');
const naming = require('frappejs/model/naming');
const { registerReportMethods } = require('../reports');
module.exports = {
async start() {
await server.start({
backend: 'sqlite',
connectionParams: { dbPath: 'test.db' },
staticPath: './www',
models: require('../models')
})
await this.postStart();
},
async postStart() {
// 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.Bill.documentClass = require('../models/doctype/Bill/BillServer.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-', 'InvoiceSettings');
await naming.createNumberSeries('BILL-', 'BillSettings');
await naming.createNumberSeries('PAY-', 'PaymentSettings');
await naming.createNumberSeries('JV-', 'JournalEntrySettings');
await naming.createNumberSeries('QTN-', 'QuotationSettings');
registerReportMethods();
}
}