2
0
mirror of https://github.com/frappe/books.git synced 2024-12-31 22:11:48 +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

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ Thumbs.db
.cache .cache
/temp /temp
dist dist
Frappe Accounting*

View File

@ -19,7 +19,7 @@ module.exports = {
}) })
frappe.desk.menu.addItem('ToDo', '#list/ToDo'); 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('Items', '#list/Item');
frappe.desk.menu.addItem('Customers', '#list/Customer'); frappe.desk.menu.addItem('Customers', '#list/Customer');
frappe.desk.menu.addItem('Invoice', '#list/Invoice'); frappe.desk.menu.addItem('Invoice', '#list/Invoice');
@ -27,7 +27,7 @@ module.exports = {
frappe.desk.menu.addItem('Contact', "#list/Contact"); frappe.desk.menu.addItem('Contact', "#list/Contact");
frappe.desk.menu.addItem('Settings', () => frappe.desk.showFormModal('SystemSettings')); 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); frappe.router.show(window.location.hash);

View File

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

View File

@ -13,7 +13,7 @@ let mainWindow
function createWindow () { function createWindow () {
// Create the browser window. // 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. // and load the index.html of the app.
mainWindow.loadURL(url.format({ mainWindow.loadURL(url.format({

View File

@ -85,5 +85,9 @@ module.exports = {
getRowHTML(list, data) { getRowHTML(list, data) {
return `<div class="col-11">${list.getNameHTML(data)} (${data.rootType})</div>`; 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)) { if (!accountFields.includes(accountName)) {
let isGroup = identifyIsGroup(child); let isGroup = identifyIsGroup(child);
const doc = frappe.newDoc({ const doc = frappe.newDoc({
doctype: 'Account', doctype: 'Account',
name: accountName, name: accountName,
@ -33,11 +32,14 @@ function identifyIsGroup(child) {
return child.isGroup; return child.isGroup;
} }
if (Object.keys(child).some(key => accountFields.includes(key))) { const keys = Object.keys(child);
return 0; const children = keys.filter(key => !accountFields.includes(key))
if (children.length) {
return 1;
} }
return 1; return 0;
} }
module.exports = async function importCharts(chart) { module.exports = async function importCharts(chart) {

View File

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

1727
www/dist/js/bundle.js vendored

File diff suppressed because it is too large Load Diff