2
0
mirror of https://github.com/frappe/books.git synced 2025-01-22 22:58:28 +00:00

fix: currency sigil not appearing post setup

This commit is contained in:
18alantom 2022-02-02 13:53:04 +05:30
parent 45e0af46f3
commit 3dd7c2e1c7
3 changed files with 21 additions and 9 deletions

View File

@ -37,13 +37,13 @@ export default async function postStart() {
await frappe.getSingle('GetStarted');
// cache currency symbols for frappe.format
frappe.currencySymbols = await getCurrencySymbols();
await setCurrencySymbols();
registerServerMethods();
}
function getCurrencySymbols() {
return frappe.db
export async function setCurrencySymbols() {
frappe.currencySymbols = await frappe.db
.getAll({
doctype: 'Currency',
fields: ['name', 'symbol'],

View File

@ -15,7 +15,7 @@
/>
<SetupWizard
v-if="activeScreen === 'SetupWizard'"
@setup-complete="showSetupWizardOrDesk(true)"
@setup-complete="setupComplete"
@setup-canceled="setupCanceled"
/>
<div id="toast-container" class="absolute bottom-0 right-0 mr-6 mb-3">
@ -34,7 +34,11 @@ import WindowsTitleBar from '@/components/WindowsTitleBar';
import { ipcRenderer } from 'electron';
import config from '@/config';
import { IPC_MESSAGES, IPC_ACTIONS } from '@/messages';
import { connectToLocalDatabase, purgeCache } from '@/initialization';
import {
connectToLocalDatabase,
postSetup,
purgeCache,
} from '@/initialization';
import { routeTo } from './utils';
import fs from 'fs/promises';
import { showErrorDialog } from './errorHandling';
@ -78,7 +82,7 @@ export default {
);
if (connectionSuccess) {
this.showSetupWizardOrDesk();
this.showSetupWizardOrDesk(false);
return;
}
@ -92,6 +96,10 @@ export default {
this.activeScreen = 'DatabaseSelector';
},
methods: {
async setupComplete() {
await postSetup();
await this.showSetupWizardOrDesk(true);
},
async showSetupWizardOrDesk(resetRoute = false) {
const { setupComplete } = frappe.AccountingSettings;
if (!setupComplete) {

View File

@ -3,9 +3,9 @@ import SQLiteDatabase from 'frappe/backends/sqlite';
import fs from 'fs';
import models from '../models';
import regionalModelUpdates from '../models/regionalModelUpdates';
import postStart from '../server/postStart';
import postStart, { setCurrencySymbols } from '../server/postStart';
import { DB_CONN_FAILURE } from './messages';
import migrate from './migrate';
import runMigrate from './migrate';
import { callInitializeMoneyMaker, getSavePath } from './utils';
export async function createNewDatabase() {
@ -59,7 +59,7 @@ export async function connectToLocalDatabase(filePath) {
}
try {
await migrate();
await runMigrate();
await postStart();
} catch (error) {
if (!error.message.includes('SQLITE_CANTOPEN')) {
@ -113,3 +113,7 @@ export function purgeCache(purgeAll = false) {
frappe.initializeAndRegister(models, true);
}
}
export async function postSetup() {
await setCurrencySymbols();
}