Problem in sorting by autogenerated invoice number

Problem in sorting by autogenerated invoice number

Hi, we are adopting the following numbering scheme:
2012-0001
2012-0002
etc

Unfortunately, when we create the invoice, this is saved as 2012-1, 2012-2 etc
in other words the leading zeros are ignored.
This obviously generates a sorting issue, e.g: 2012-2 is considered higher than 2012-11 and so on

Oddly enough, when we are creating a new invoice, the invoice# in the field of the invoice creation
form seem to be correct (the leading zeros are still there). it is only after the invoice is created and displayed in the list that the zeros are missing.

Can you please fix this bug?
Thank you in advance