Merge pull request #1172 from SchrodingersGat/duplicate-ipn-fix

Bugfix for duplicate IPN checks when blank IPN is used
This commit is contained in:
Oliver 2020-12-16 21:53:14 +11:00 committed by GitHub
commit a8c6e79bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -594,7 +594,7 @@ class Part(MPTTModel):
# User can decide whether duplicate IPN (Internal Part Number) values are allowed
allow_duplicate_ipn = common.models.InvenTreeSetting.get_setting('PART_ALLOW_DUPLICATE_IPN')
if not allow_duplicate_ipn:
if self.IPN is not None and not allow_duplicate_ipn:
parts = Part.objects.filter(IPN__iexact=self.IPN)
parts = parts.exclude(pk=self.pk)