2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-14 19:15:41 +00:00

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

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)