mirror of
https://github.com/frappe/books.git
synced 2024-11-13 00:46:28 +00:00
Merge pull request #443 from 18alantom/minor-fixes-four
fix: minor fixes four
This commit is contained in:
commit
60a95cb53a
@ -1,5 +1,6 @@
|
|||||||
import { ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import { t } from 'fyo';
|
import { t } from 'fyo';
|
||||||
|
import { ConfigKeys } from 'fyo/core/types';
|
||||||
import { Doc } from 'fyo/model/doc';
|
import { Doc } from 'fyo/model/doc';
|
||||||
import { BaseError } from 'fyo/utils/errors';
|
import { BaseError } from 'fyo/utils/errors';
|
||||||
import { ErrorLog } from 'fyo/utils/types';
|
import { ErrorLog } from 'fyo/utils/types';
|
||||||
@ -176,6 +177,11 @@ function getIssueUrlQuery(errorLogObj?: ErrorLog): string {
|
|||||||
body.push(`**Platform**: \`${fyo.store.platform}\``);
|
body.push(`**Platform**: \`${fyo.store.platform}\``);
|
||||||
body.push(`**Path**: \`${router.currentRoute.value.fullPath}\``);
|
body.push(`**Path**: \`${router.currentRoute.value.fullPath}\``);
|
||||||
|
|
||||||
|
body.push(`**Language**: \`${fyo.config.get(ConfigKeys.Language)}\``);
|
||||||
|
if (fyo.singles.SystemSettings?.countryCode) {
|
||||||
|
body.push(`**Country**: \`${fyo.singles.SystemSettings.countryCode}\``);
|
||||||
|
}
|
||||||
|
|
||||||
const url = [baseUrl, `body=${body.join('\n')}`].join('&');
|
const url = [baseUrl, `body=${body.join('\n')}`].join('&');
|
||||||
return encodeURI(url);
|
return encodeURI(url);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,6 @@
|
|||||||
type="text"
|
type="text"
|
||||||
v-model="newAccountName"
|
v-model="newAccountName"
|
||||||
:disabled="insertingAccount"
|
:disabled="insertingAccount"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
v-if="!insertingAccount"
|
v-if="!insertingAccount"
|
||||||
@ -164,7 +163,7 @@ export default {
|
|||||||
if (fyo.store.isDevelopment) {
|
if (fyo.store.isDevelopment) {
|
||||||
window.coa = this;
|
window.coa = this;
|
||||||
}
|
}
|
||||||
docsPath.value = docsPathMap.ChartOfAccounts
|
docsPath.value = docsPathMap.ChartOfAccounts;
|
||||||
},
|
},
|
||||||
deactivated() {
|
deactivated() {
|
||||||
docsPath.value = '';
|
docsPath.value = '';
|
||||||
@ -184,28 +183,44 @@ export default {
|
|||||||
};
|
};
|
||||||
this.accounts = await this.getChildren();
|
this.accounts = await this.getChildren();
|
||||||
},
|
},
|
||||||
onClick(account) {
|
async onClick(account) {
|
||||||
if (!account.isGroup) {
|
let shouldOpen = !account.isGroup;
|
||||||
openQuickEdit({
|
if (account.isGroup) {
|
||||||
schemaName: ModelNameEnum.Account,
|
shouldOpen = !(await this.toggleChildren(account));
|
||||||
name: account.name,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.toggleChildren(account);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!shouldOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await openQuickEdit({
|
||||||
|
schemaName: ModelNameEnum.Account,
|
||||||
|
name: account.name,
|
||||||
|
});
|
||||||
|
|
||||||
|
const doc = await fyo.doc.getDoc(ModelNameEnum.Account, account.name);
|
||||||
|
doc.once('afterDelete', () => this.fetchAccounts());
|
||||||
},
|
},
|
||||||
async toggleChildren(account) {
|
async toggleChildren(account) {
|
||||||
await this.fetchChildren(account);
|
const hasChildren = await this.fetchChildren(account);
|
||||||
|
if (!hasChildren) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
account.expanded = !account.expanded;
|
account.expanded = !account.expanded;
|
||||||
if (!account.expanded) {
|
if (!account.expanded) {
|
||||||
account.addingAccount = 0;
|
account.addingAccount = 0;
|
||||||
account.addingGroupAccount = 0;
|
account.addingGroupAccount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
async fetchChildren(account, force = false) {
|
async fetchChildren(account, force = false) {
|
||||||
if (account.children == null || force) {
|
if (account.children == null || force) {
|
||||||
account.children = await this.getChildren(account.name);
|
account.children = await this.getChildren(account.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return !!account?.children?.length;
|
||||||
},
|
},
|
||||||
async getChildren(parent = null) {
|
async getChildren(parent = null) {
|
||||||
const children = await fyo.db.getAll(ModelNameEnum.Account, {
|
const children = await fyo.db.getAll(ModelNameEnum.Account, {
|
||||||
|
@ -207,26 +207,28 @@ export async function createDiscountAccount(fyo: Fyo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setDefaultAccounts(fyo: Fyo) {
|
async function setDefaultAccounts(fyo: Fyo) {
|
||||||
const accountMap: Record<string, string> = {
|
await setDefaultAccount('writeOffAccount', fyo.t`Write Off`, fyo);
|
||||||
writeOffAccount: fyo.t`Write Off`,
|
const isSet = await setDefaultAccount(
|
||||||
roundOffAccount: fyo.t`Rounded Off`,
|
'roundOffAccount',
|
||||||
};
|
fyo.t`Rounded Off`,
|
||||||
|
fyo
|
||||||
|
);
|
||||||
|
|
||||||
for (const key in accountMap) {
|
if (!isSet) {
|
||||||
const accountName = accountMap[key];
|
await setDefaultAccount('roundOffAccount', fyo.t`Round Off`, fyo);
|
||||||
const accountExists = await fyo.db.exists(
|
|
||||||
ModelNameEnum.Account,
|
|
||||||
accountName
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!accountExists) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
await fyo.singles.AccountingSettings!.setAndSync(key, accountName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setDefaultAccount(key: string, accountName: string, fyo: Fyo) {
|
||||||
|
const accountExists = await fyo.db.exists(ModelNameEnum.Account, accountName);
|
||||||
|
if (!accountExists) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
await fyo.singles.AccountingSettings!.setAndSync(key, accountName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
async function completeSetup(companyName: string, fyo: Fyo) {
|
async function completeSetup(companyName: string, fyo: Fyo) {
|
||||||
await fyo.singles.AccountingSettings!.setAndSync('setupComplete', true);
|
await fyo.singles.AccountingSettings!.setAndSync('setupComplete', true);
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ Account,Konto,
|
|||||||
"Accounting Ledger Entry",,
|
"Accounting Ledger Entry",,
|
||||||
"Accounting Settings",Buchhaltungseinstellungen,
|
"Accounting Settings",Buchhaltungseinstellungen,
|
||||||
Accounts,Konten,
|
Accounts,Konten,
|
||||||
"Accounts Payable",Kreditoren,
|
"Accounts Payable",Verbindlichkeiten,
|
||||||
"Accounts Receivable",Debitoren,
|
"Accounts Receivable",Forderungen,
|
||||||
"Accumulated Depreciation","Kumulierte Abschreibung",
|
"Accumulated Depreciation","Kumulierte Abschreibung",
|
||||||
"Add Account","Konto hinzufügen",
|
"Add Account","Konto hinzufügen",
|
||||||
"Add Customers","Kunden hinzufügen",
|
"Add Customers","Kunden hinzufügen",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user