Rebuild the chart of accounts tree
ERPNext stores internal tree indexes for the chart of accounts. Reports use them to find the accounts under a group. If the indexes no longer match the saved Parent Account values, reports can group accounts wrongly. Rebuild Tree recalculates the indexes from the parents.
This is a repair tool. It does not create or change any posting, and it does not move an account to another parent.
When to rebuild
Rebuild the tree when the Parent Account of each account is correct, but:
- the General Ledger filtered to one ledger account shows rows of another account;
- a group total leaves out a child account;
- the Balance Sheet or Profit and Loss report groups an account under the wrong group;
- a recent parent change does not show in all reports.
TIP
When you filter the General Ledger by a group account, it shows all accounts under that group. This is expected and is not a damaged tree.
Prerequisites
- You checked the report filters: company, dates, account, finance book, currency, and dimensions.
- You opened each affected account and confirmed its Parent Account, Root Type, Report Type, company, and Is Group.
- On a production site, you have a recent backup and a quiet time to run the repair.
Rebuild the tree
- Open the Chart of Accounts and select the company.
- Check that the tree shows the structure that you expect.
- Open the menu (the three dots at the top right) and select Rebuild Tree.
Check the result
- Run the report that showed the problem, with the same filters.
- In the General Ledger, filter by one ledger account. Only that account's rows show.
- Filter by its parent group. Only the correct child accounts show.
- Check the opening, debit, credit, and closing balances.
If the problem stays, the cause is elsewhere: a wrong Parent Account, a filter, a finance book, a currency, or a document. Do not edit the tree indexes in the database.