Open Tab outliner window
Press F12 to bring up developer console
Click the console tab and copy and paste the code below and hit enter
Found this on github, and can confirm it works.
treeView.treeModel.currentSession_rootNode.subnodes.forEach(node => node.setCollapsing(true))
Служба підтримки клієнтів працює на UserEcho
Open Tab outliner window
Press F12 to bring up developer console
Click the console tab and copy and paste the code below and hit enter
Found this on github, and can confirm it works.