Added a unique constraint to the account code in the accounting application.

This commit is contained in:
依瑪貓 2020-07-21 10:59:48 +08:00
parent bace7bb93b
commit 6f47c08c80

View File

@ -32,7 +32,7 @@ class Account(models.Model):
parent = models.ForeignKey( parent = models.ForeignKey(
"self", on_delete=models.PROTECT, null=True, blank=True, "self", on_delete=models.PROTECT, null=True, blank=True,
db_column="parent_sn") db_column="parent_sn")
code = models.CharField(max_length=5) code = models.CharField(max_length=5, unique=True)
title_zh_hant = models.CharField( title_zh_hant = models.CharField(
max_length=32, db_column="title_zhtw") max_length=32, db_column="title_zhtw")
title_en = models.CharField(max_length=128, null=True, blank=True) title_en = models.CharField(max_length=128, null=True, blank=True)