Skip to content

Commit

Permalink
Enforce invoice number uniqueness.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Gaevsky committed Apr 3, 2019
1 parent 77c1891 commit e7c4676
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion oscar_invoices/abstract_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class AbstractInvoice(models.Model):
verbose_name=_('Legal Entity'))

number = models.CharField(
_('Invoice number'), max_length=128)
_('Invoice number'), max_length=128, unique=True)

order = models.OneToOneField(
'order.Order', verbose_name=_('Order'), related_name='invoice',
Expand Down
18 changes: 18 additions & 0 deletions oscar_invoices/migrations/0003_auto_20190403_1910.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.1.8 on 2019-04-03 19:10

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('oscar_invoices', '0002_auto_20180822_1335'),
]

operations = [
migrations.AlterField(
model_name='invoice',
name='number',
field=models.CharField(max_length=128, unique=True, verbose_name='Invoice number'),
),
]

0 comments on commit e7c4676

Please sign in to comment.