fix: Javascript "is undefined" error (#2266)

Make Chart of Accounts Javascript run without error when no accounts exist

Fixes: WEB-10
This commit is contained in:
Felix van Hove
2025-02-20 21:55:51 -06:00
committed by GitHub
parent 30e895c352
commit ca2123edb4
@@ -59,6 +59,10 @@ export class GlAccountTreeService {
new GLAccountNode(this.translateService.instant('labels.inputs.accounting.LIABILITY'))
);
if (glAccountData.length === 0) {
return glAccountTree;
}
// Sort by parent id (so that child nodes can be added properly)
if (!glAccountData[0].parentId) {
glAccountData[0].parentId = 0;