From a77fd23fcf5d30f8e226aef068ef0d3d124c701e Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 17 Sep 2019 20:19:27 +1000 Subject: [PATCH] Add a reminder for future-self --- InvenTree/part/models.py | 2 ++ InvenTree/part/templates/part/tabs.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 5040bdc2f0..a06d5ea718 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -1140,6 +1140,8 @@ class BomItem(models.Model): if self.part == self.sub_part: raise ValidationError({'sub_part': _('Part cannot be added to its own Bill of Materials')}) + # TODO - Make sure that there is no recusion + # Test for simple recursion for item in self.sub_part.bom_items.all(): if self.part == item.sub_part: diff --git a/InvenTree/part/templates/part/tabs.html b/InvenTree/part/templates/part/tabs.html index 86b7986b00..23b0f8070c 100644 --- a/InvenTree/part/templates/part/tabs.html +++ b/InvenTree/part/templates/part/tabs.html @@ -13,7 +13,7 @@ Stock {{ part.total_stock }} - {% if part.allocation_count > 0 %} + {% if part.component or part.used_in_count > 0 %} Allocated {{ part.allocation_count }}