diff --git a/smash/web/forms/voucher_forms.py b/smash/web/forms/voucher_forms.py index 67dabe3c04ee6675ed6a721c71d9e1002d02798b..12aaa87601afa721a9c9c84d7e7cd20f283d4a0a 100644 --- a/smash/web/forms/voucher_forms.py +++ b/smash/web/forms/voucher_forms.py @@ -70,7 +70,7 @@ class VoucherForm(ModelForm): instance.expiry_date = instance.issue_date + datetime.timedelta(days=90) max_id = str(1).zfill(5) if Voucher.objects.all().count() > 0: - max_id = str(Voucher.objects.latest('id').id + 1).zfill(5) + max_id = str(Voucher.objects.latest('id').id + 1).zfill(4) # number in format {ND_NUMBER}-{DATE}-{VOUCHER_TYPE_CODE}-{VOUCHER_TYPE}-{SEQ_NUMBER}{CHECKSUM} instance.number = instance.study_subject.nd_number + "-" + \ datetime.datetime.now().strftime("%Y%m%d") + "-" + \