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

Add a button to create a new part if necessary

This commit is contained in:
Oliver Walters
2019-07-07 11:56:44 +10:00
parent a6da3ed4a4
commit ff5af8f217
3 changed files with 20 additions and 1 deletions

View File

@ -685,7 +685,7 @@ class Part(models.Model):
- Exclude parts which this part is in the BOM for
"""
parts = Part.objects.filter(component=True)
parts = Part.objects.filter(component=True).exclude(id=self.id)
parts = parts.exclude(id__in=[part.id for part in self.used_in.all()])
return parts