How to have an automatic serial invoice number generated

How to have an automatic serial invoice number generated ? I tried writing “XXX{yy}{mm}-{00000}” in the mask for invoice numbers in Administration and no luck. I had it working for patients mask by writing {00000}.

After searching the old topics can’t get a simple solution to have an invoice number automatically generated after payment is complete