diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index 61e91bc2e1..bbb44a14e6 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -107,6 +107,11 @@ class PartList(generics.ListCreateAPIView): ] filter_fields = [ + 'buildable', + 'consumable', + 'trackable', + 'purchaseable', + 'salable', ] ordering_fields = [ diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index 294da2f114..19f899c919 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -48,8 +48,10 @@ class EditPartForm(HelperForm): 'URL', 'default_location', 'default_supplier', + 'units', 'minimum_stock', 'buildable', + 'consumable', 'trackable', 'purchaseable', 'salable', diff --git a/InvenTree/part/migrations/0005_part_consumable.py b/InvenTree/part/migrations/0005_part_consumable.py new file mode 100644 index 0000000000..4bb1056ae7 --- /dev/null +++ b/InvenTree/part/migrations/0005_part_consumable.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2 on 2019-04-15 13:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0004_bomitem_note'), + ] + + operations = [ + migrations.AddField( + model_name='part', + name='consumable', + field=models.BooleanField(default=False, help_text='Can this part be used to build other parts?'), + ), + ] diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 2f65744139..bcb9163c7d 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -126,9 +126,12 @@ class Part(models.Model): # Units of quantity for this part. Default is "pcs" units = models.CharField(max_length=20, default="pcs", blank=True) - # Can this part be built? + # Can this part be built from other parts? buildable = models.BooleanField(default=False, help_text='Can this part be built from other parts?') + # Can this part be used to make other parts? + consumable = models.BooleanField(default=True, help_text='Can this part be used to build other parts?') + # Is this part "trackable"? # Trackable parts can have unique instances # which are assigned serial numbers (or batch numbers) diff --git a/InvenTree/part/serializers.py b/InvenTree/part/serializers.py index d037e86499..5e2596d126 100644 --- a/InvenTree/part/serializers.py +++ b/InvenTree/part/serializers.py @@ -61,6 +61,7 @@ class PartSerializer(serializers.ModelSerializer): 'units', 'trackable', 'buildable', + 'consumable', 'trackable', 'salable', ] diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index c43aec77eb..b340ec35c5 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -32,7 +32,7 @@
In Stock | diff --git a/InvenTree/part/templates/part/tabs.html b/InvenTree/part/templates/part/tabs.html index 3c5773b8e2..aa9d798bb7 100644 --- a/InvenTree/part/templates/part/tabs.html +++ b/InvenTree/part/templates/part/tabs.html @@ -7,7 +7,7 @@