2018-10-21 12:49:33 +00:00
|
|
|
const frappe = require('frappejs');
|
|
|
|
const registerReportMethods = require('../reports');
|
|
|
|
|
|
|
|
module.exports = function registerServerMethods() {
|
|
|
|
registerReportMethods();
|
|
|
|
|
|
|
|
frappe.registerMethod({
|
|
|
|
method: 'import-coa',
|
|
|
|
async handler() {
|
|
|
|
const importCOA = require('../models/doctype/Account/importCOA');
|
2019-02-11 13:14:50 +00:00
|
|
|
await importCOA();
|
2018-10-21 12:49:33 +00:00
|
|
|
}
|
|
|
|
});
|
2018-10-22 18:02:47 +00:00
|
|
|
|
|
|
|
frappe.registerMethod({
|
|
|
|
method: 'print-pdf',
|
2018-10-22 20:48:38 +00:00
|
|
|
handler({doctype, name, html}) {
|
2018-10-22 18:02:47 +00:00
|
|
|
if (frappe.isElectron) {
|
|
|
|
const path = require('path');
|
|
|
|
const { getPDFForElectron } = require('frappejs/server/pdf');
|
|
|
|
const { getSettings } = require('../electron/settings');
|
2019-02-17 17:46:50 +00:00
|
|
|
const destination = path.resolve(getSettings().dbPath, '..')
|
2018-10-22 20:48:38 +00:00
|
|
|
getPDFForElectron(doctype, name, destination, html);
|
2018-10-22 18:02:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2018-10-21 12:49:33 +00:00
|
|
|
}
|