From bafce641a78230050d476ab01d4e04c87eef7154 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 16 Apr 2019 01:45:16 +1000 Subject: [PATCH] Limit sub-part choices to consumable parts only --- InvenTree/part/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index bcb9163c7d..54d5f32a9d 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -371,11 +371,12 @@ class BomItem(models.Model): # A link to the parent part # Each part will get a reverse lookup field 'bom_items' part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='bom_items', - limit_choices_to={'buildable': True}) + limit_choices_to={'buildable': True}) # A link to the child item (sub-part) # Each part will get a reverse lookup field 'used_in' - sub_part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='used_in') + sub_part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='used_in', + limit_choices_to={'consumable': True}) # Quantity required quantity = models.PositiveIntegerField(default=1, validators=[MinValueValidator(0)])