[X++] Error "Voucher already in use as of date"

When seeing the error message
"Voucher CEU-000001 is already used as of date 31.12.2014."
(sequence number and date can vary) it is based on duplicate number sequences.

duplicate Number Sequence Error Message

In my case it appeared when posting a sales invoice.
The number sequence for Sales order - free text invoice was set up with the same format as the number sequence for Sales order - invoice.

To fix the number sequences, I went to Accounts receivable\Setup\Accounts receivable parameters\Number sequences and changed the format of one of those two number sequences to make it unique:
duplicate number sequence setup

So always set up transactional related number sequences with an unique format!