From ff5af8f217bef9e441e23c51d7d20e3403657222 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 7 Jul 2019 11:56:44 +1000 Subject: [PATCH] Add a button to create a new part if necessary --- InvenTree/part/models.py | 2 +- .../templates/part/bom_upload/select_parts.html | 4 ++++ InvenTree/static/script/inventree/bom.js | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index b0a96c8759..dc1a0e9568 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -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 diff --git a/InvenTree/part/templates/part/bom_upload/select_parts.html b/InvenTree/part/templates/part/bom_upload/select_parts.html index 803f9dc496..8a1a7b17a6 100644 --- a/InvenTree/part/templates/part/bom_upload/select_parts.html +++ b/InvenTree/part/templates/part/bom_upload/select_parts.html @@ -47,6 +47,10 @@ {% for item in row.data %} {% if item.column.guess == 'Part' %} + +