Tree view performance with deeply nested chart of accounts

I’ve started a chart of accounts for United States GAAP accounting. Before getting feedback on the module from an accounting point of view, I have a question about the performance of loading a chart of accounts or account templates into the expandable list view. There are some accounts that are 8 levels deep (perhaps 70 out of about 1000 accounts at the moment) and this seems to slow down the expansion of the chart of accounts considerably (13-14 minutes on my machine if I expand all with Shift-Right Arrow). Once the chart is loaded there is no performance problem scrolling through the chart. There are also no performance issues with the account list view that is not expandable.

I’ve run a profile of the tryton client (100 samples/sec), but I’m not very familiar with Tryton’s codebase yet so I’m not sure I’m profiling the right thing. I thought perhaps someone more knowledgeable might have an idea on what else to look for? For the profile, trytond is using a test sqlite database but the problem is the same on postgresql.

This level of nesting doesn’t seem to me to be too extreme for more low-level accounts from a business perspective, but if anyone else has had experience needing to take a different approach to make a detailed chart of accounts work functionally for Tryton it would be helpful to know.

Just do not do it. This trigger a call for each row expanded.

Okay, that seems to be a simple enough solution. :laughing:

The only use case I have had for it is to make sure that I’ve nested accounts properly as I’ve worked on the module. But I can do that in more specific branches of accounts going forward, and this wouldn’t be a use case in a normal day-to-day use of the system.