mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
Adds check for duplicate parts when importing
This commit is contained in:
parent
67a9c0aeec
commit
2af617e92b
@ -870,6 +870,8 @@ class BomExtractSerializer(serializers.Serializer):
|
|||||||
rows = []
|
rows = []
|
||||||
errors = []
|
errors = []
|
||||||
|
|
||||||
|
found_parts = set()
|
||||||
|
|
||||||
headers = self.dataset.headers
|
headers = self.dataset.headers
|
||||||
|
|
||||||
level_column = self.find_matching_column('level', headers)
|
level_column = self.find_matching_column('level', headers)
|
||||||
@ -939,8 +941,14 @@ class BomExtractSerializer(serializers.Serializer):
|
|||||||
# Multiple matches!
|
# Multiple matches!
|
||||||
error['part'] = _('Multiple matching parts found')
|
error['part'] = _('Multiple matching parts found')
|
||||||
|
|
||||||
if part is None and 'part' not in error:
|
if part is None:
|
||||||
error['part'] = _('No matching part found')
|
if 'part' not in error:
|
||||||
|
error['part'] = _('No matching part found')
|
||||||
|
else:
|
||||||
|
if part.pk in found_parts:
|
||||||
|
error['part'] = _('Duplicate part selected')
|
||||||
|
else:
|
||||||
|
found_parts.add(part.pk)
|
||||||
|
|
||||||
row['part'] = part.pk if part is not None else None
|
row['part'] = part.pk if part is not None else None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user