2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-13 10:35:40 +00:00

Add some unit testing for the new model

This commit is contained in:
Oliver
2021-10-13 22:27:10 +11:00
parent 8512c2db75
commit 0f8c279aa2
4 changed files with 85 additions and 5 deletions

View File

@ -2629,6 +2629,12 @@ class BomItemSubstitute(models.Model):
# Prevent duplication of substitute parts
unique_together = ('part', 'bom_item')
def save(self, *args, **kwargs):
self.full_clean()
super().save(*args, **kwargs)
def validate_unique(self, exclude=None):
"""
Ensure that this BomItemSubstitute is "unique":