diff --git a/models/doctype/DashboardChart/DashboardChart.js b/models/doctype/DashboardChart/DashboardChart.js deleted file mode 100644 index c384a591..00000000 --- a/models/doctype/DashboardChart/DashboardChart.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = { - name: 'DashboardChart', - doctype: 'DocType', - isChild: 1, - fields: [ - { - fieldname: 'account', - fieldtype: 'Link', - label: 'Account', - target: 'Account' - }, - { - fieldname: 'type', - fieldtype: 'Select', - options: ['Bar', 'Line', 'Percentage'], - label: 'Chart Type', - defaultValue: 'Bar' - }, - { - fieldname: 'color', - fieldtype: 'Link', - label: 'Color', - target: 'Color' - } - ] -}; diff --git a/models/doctype/DashboardSettings/DashboardSettings.js b/models/doctype/DashboardSettings/DashboardSettings.js deleted file mode 100644 index 5cea3748..00000000 --- a/models/doctype/DashboardSettings/DashboardSettings.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - name: 'DashboardSettings', - label: 'Dashboard Settings', - doctype: 'DocType', - isSingle: 1, - fields: [ - { - fieldname: 'charts', - fieldtype: 'Table', - label: 'Charts', - childtype: 'DashboardChart' - } - ] -}; diff --git a/models/index.js b/models/index.js index 60827c3e..15df9d08 100644 --- a/models/index.js +++ b/models/index.js @@ -1,7 +1,5 @@ module.exports = { SetupWizard: require('./doctype/SetupWizard/SetupWizard'), - DashboardSettings: require('./doctype/DashboardSettings/DashboardSettings'), - DashboardChart: require('./doctype/DashboardChart/DashboardChart'), Currency: require('./doctype/Currency/Currency'), Color: require('./doctype/Color/Color'), Account: require('./doctype/Account/Account.js'), diff --git a/src/main.js b/src/main.js index 9758fb4e..ac4e0877 100644 --- a/src/main.js +++ b/src/main.js @@ -104,14 +104,8 @@ import router from './router'; }); await printSettings.update(); - const systemSettings = await frappe.getSingle('SystemSettings'); - await systemSettings.set({ - dateFormat: countryList[country]['date_format'] || 'yyyy-MM-dd' - }); - await systemSettings.update(); - await setupGlobalCurrencies(countryList); - await setupAccountsAndDashboard(bankName); + await setupChartOfAccounts(bankName); await setupRegionalChanges(country); await setupWizardValues.set({ completed: 1 }); @@ -150,10 +144,10 @@ import router from './router'; } } } - Promise.all(promises); + return Promise.all(promises); } - async function setupAccountsAndDashboard(bankName) { + async function setupChartOfAccounts(bankName) { await frappe.call({ method: 'import-coa' }); @@ -169,38 +163,6 @@ import router from './router'; isGroup: 0 }); accountDoc.insert(); - - const dashboardSettings = await frappe.getSingle('DashboardSettings'); - const accounts = await frappe.db.getAll({ - doctype: 'Account', - filters: { parentAccount: null } - }); - - const colors = [ - { name: 'Red', hexvalue: '#d32f2f' }, - { name: 'Green', hexvalue: '#388e3c' }, - { name: 'Blue', hexvalue: '#0288d1' }, - { name: 'Yellow', hexvalue: '#cddc39' } - ]; - colors.forEach(async color => { - const c = await frappe.newDoc({ doctype: 'Color' }); - c.set(color); - c.insert(); - }); - - let charts = []; - accounts.forEach(account => { - charts.push({ - account: account.name, - type: 'Bar', - color: colors[Math.floor(Math.random() * 4)].name - }); - }); - - await dashboardSettings.set({ - charts - }); - await dashboardSettings.update(); } async function setupRegionalChanges(country) {