2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 10:05:39 +00:00

Prevent duplication of unique parts

This commit is contained in:
Oliver Walters
2017-04-14 16:09:05 +10:00
parent 6f31e3447c
commit 5b49cff09a
3 changed files with 41 additions and 8 deletions

View File

@ -149,11 +149,9 @@ class PartParameterManager(models.Manager):
part_id = kwargs['part']
template_id = kwargs['template']
try:
params = self.filter(part=part_id, template=template_id)
params = self.filter(part=part_id, template=template_id)
if len(params) > 0:
return params[0]
except:
pass
return super(PartParameterManager, self).create(*args, **kwargs)