Re: How correctly to implement numbering of documents in Alfresco?
I am not aware of an out of the box solution. There may well be some add ons or well trodden path. You will most likely have to generate the id yourself.
Can you use the unique identifier Alfresco provides - or build something from this?
If not, I would suggest you write your own logic to assign an "id" as a rule. If you group the documents into some folder structure with a naming pattern you can use the constraint for unique children names to enforce uniqueness. I am not sure what linking it to a template means.