Sorting order of templates in the pop-up window when printing Quotes as PDF

Does anyone have a solution for sorting the PDF templates in alphabetic order in the pop-up window when you print a quote as PDF file?
I’ve tried to find a solution for it but found only old issues with no solution.
This is really pain for us, because we have 20 active PDF templates and in the “Please Select a Template:” window they appear in random order.

Probably the quickest way to achieve this without diving into the code would be to see if you can induce some order from the database itself. I’m not sure how the query is made, but it might not be too difficult, you can try different things (changing ids, etc) to see what is causing a specific order to appear.

The query is done in modules/AOS_Quotes/views/view.detail.php
You could extend that class and redefine populateQuoteTemplates function