Automatic code for detailed accounts

as of my understanding for manually entering chart of accounts, entering an account under a group doesn’t automatically numbers the account based on the group number. The account number has to be entered manually. How to make it so that the account new in account group takes the number of the group automatically? For example the first account in group of number 521 becomes automatically 5211, second 5212…

this is the solution