2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 03:19:01 +00:00

fix: prevent cannot read prop rootType

This commit is contained in:
18alantom 2023-05-30 11:54:33 +05:30 committed by Alan
parent 497d2bbd34
commit fba3fb76c6
3 changed files with 15 additions and 7 deletions

View File

@ -19,11 +19,15 @@ export class Account extends Doc {
parentAccount?: string; parentAccount?: string;
get isDebit() { get isDebit() {
const debitAccounts = [ if (this.rootType === AccountRootTypeEnum.Asset) {
AccountRootTypeEnum.Asset, return true;
AccountRootTypeEnum.Expense, }
] as AccountRootType[];
return debitAccounts.includes(this.rootType!); if (this.rootType === AccountRootTypeEnum.Expense) {
return true;
}
return false;
} }
get isCredit() { get isCredit() {
@ -100,7 +104,7 @@ export class Account extends Doc {
isGroup: true, isGroup: true,
}; };
if (doc.rootType) { if (doc?.rootType) {
filter.rootType = doc.rootType as string; filter.rootType = doc.rootType as string;
} }

View File

@ -69,6 +69,10 @@ export default defineComponent({
}) })
)[0]; )[0];
if (!data) {
return;
}
this.values = fields this.values = fields
.map((f) => { .map((f) => {
const value = data[f.fieldname]; const value = data[f.fieldname];

View File

@ -36,7 +36,7 @@ export async function sendError(errorLogObj: ErrorLog) {
device_id: fyo.store.deviceId, device_id: fyo.store.deviceId,
open_count: fyo.store.openCount, open_count: fyo.store.openCount,
country_code: fyo.singles.SystemSettings?.countryCode, country_code: fyo.singles.SystemSettings?.countryCode,
more: stringifyCircular(errorLogObj.more!), more: stringifyCircular(errorLogObj.more),
}; };
if (fyo.store.isDevelopment) { if (fyo.store.isDevelopment) {