mirror of
https://github.com/frappe/books.git
synced 2026-08-24 10:04:45 -05:00
fix: Remove dashboard setup code
This commit is contained in:
@@ -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'
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'DashboardSettings',
|
||||
label: 'Dashboard Settings',
|
||||
doctype: 'DocType',
|
||||
isSingle: 1,
|
||||
fields: [
|
||||
{
|
||||
fieldname: 'charts',
|
||||
fieldtype: 'Table',
|
||||
label: 'Charts',
|
||||
childtype: 'DashboardChart'
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -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'),
|
||||
|
||||
+3
-41
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user