2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 10:58:59 +00:00

Add Chart of Accounts list item

This commit is contained in:
Faris Ansari 2018-04-09 00:03:32 +05:30
parent 5c9fd405f0
commit 7e8f37dda6
8 changed files with 1160 additions and 628 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ Thumbs.db
*.log
.cache
/temp
dist
dist
Frappe Accounting*

View File

@ -19,7 +19,7 @@ module.exports = {
})
frappe.desk.menu.addItem('ToDo', '#list/ToDo');
frappe.desk.menu.addItem('Accounts', '#list/Account');
frappe.desk.menu.addItem('Chart of Accounts', '#tree/Account');
frappe.desk.menu.addItem('Items', '#list/Item');
frappe.desk.menu.addItem('Customers', '#list/Customer');
frappe.desk.menu.addItem('Invoice', '#list/Invoice');
@ -27,7 +27,7 @@ module.exports = {
frappe.desk.menu.addItem('Contact', "#list/Contact");
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings'));
frappe.router.default = '#list/Invoice';
frappe.router.default = '#tree/Account';
frappe.router.show(window.location.hash);

View File

@ -4,6 +4,12 @@ const { writeFile } = require('frappejs/server/utils');
const appClient = require('../client');
const SetupWizard = require('../setup');
const fs = require('fs');
require.extensions['.html'] = function (module, filename) {
module.exports = fs.readFileSync(filename, 'utf8');
};
(async () => {
const configFilePath = path.join(require('os').homedir(), '.config', 'frappe-accounting', 'settings.json');
@ -20,6 +26,8 @@ const SetupWizard = require('../setup');
dbPath,
models: require('../models')
}).then(() => {
frappe.syncDoc(require('../fixtures/invoicePrint'));
appClient.start();
});
} else {
@ -62,6 +70,8 @@ const SetupWizard = require('../setup');
const chart = require('../fixtures/standardCOA');
await importCOA(chart);
frappe.syncDoc(require('../fixtures/invoicePrint'));
appClient.start();
})
}

View File

@ -13,7 +13,7 @@ let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600})
mainWindow = new BrowserWindow({width: 1024, height: 768})
// and load the index.html of the app.
mainWindow.loadURL(url.format({

View File

@ -85,5 +85,9 @@ module.exports = {
getRowHTML(list, data) {
return `<div class="col-11">${list.getNameHTML(data)} (${data.rootType})</div>`;
}
},
treeSettings: {
parentField: 'parentAccount'
}
}

View File

@ -11,7 +11,6 @@ async function importAccounts(children, parent, rootType, rootAccount) {
if (!accountFields.includes(accountName)) {
let isGroup = identifyIsGroup(child);
const doc = frappe.newDoc({
doctype: 'Account',
name: accountName,
@ -33,11 +32,14 @@ function identifyIsGroup(child) {
return child.isGroup;
}
if (Object.keys(child).some(key => accountFields.includes(key))) {
return 0;
const keys = Object.keys(child);
const children = keys.filter(key => !accountFields.includes(key))
if (children.length) {
return 1;
}
return 1;
return 0;
}
module.exports = async function importCharts(chart) {

View File

@ -7499,29 +7499,31 @@ mark {
.vertical-margin {
margin: 1rem 0px; }
.tree {
padding: 15px; }
padding: 1rem 2rem; }
.tree li {
list-style: none;
margin: 2px 0px; }
list-style: none; }
ul.tree-children {
padding-left: 20px; }
padding-left: 2rem; }
.tree-link {
cursor: pointer;
display: inline-block;
padding: 1px; }
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
width: 100%; }
.tree-link:hover {
background-color: #f8f9fa; }
.tree-link .node-parent {
color: #6c757d;
font-size: 14px;
width: 10px;
width: 24px;
height: 24px;
text-align: center; }
.tree-link .node-leaf {
color: #ced4da; }
.tree-link .node-parent, .tree-link .node-leaf {
margin-right: 5px;
margin-left: 2px;
margin-top: 3px; }
.tree-link.active svg {
color: #007bff; }
padding: 0.5rem; }
.tree-link.active a {
color: #6c757d; }
.tree-hover {

1727
www/dist/js/bundle.js vendored

File diff suppressed because it is too large Load Diff