From 04b216253d795559cb5889bffad95cd536f581e0 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 21 Jun 2021 11:30:20 +1000 Subject: [PATCH] Ok, that was a bad idea. --- InvenTree/InvenTree/serializers.py | 1 - InvenTree/part/models.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/serializers.py b/InvenTree/InvenTree/serializers.py index eea8072bf3..fa7674723c 100644 --- a/InvenTree/InvenTree/serializers.py +++ b/InvenTree/InvenTree/serializers.py @@ -50,7 +50,6 @@ class InvenTreeModelSerializer(serializers.ModelSerializer): # Now ensure the underlying model is correct instance = self.Meta.model(**data) - instance.validate_unique() instance.clean() return data diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 6c05d62a7e..8aa370a7ae 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -380,7 +380,6 @@ class Part(MPTTModel): previous.image.delete(save=False) self.clean() - self.validate_unique() super().save(*args, **kwargs) @@ -672,6 +671,8 @@ class Part(MPTTModel): super().clean() + self.validate_unique() + if self.trackable: for part in self.get_used_in().all():