diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index 338e664252..71f87ffd19 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -445,9 +445,9 @@ class IndexView(TemplateView): # TODO - Is there a less expensive way to get these from the database context['to_order'] = [part for part in Part.objects.filter(purchaseable=True) if part.need_to_restock()] - # Generate a list of buildable parts which have stock below their minimum values + # Generate a list of assembly parts which have stock below their minimum values # TODO - Is there a less expensive way to get these from the database - context['to_build'] = [part for part in Part.objects.filter(buildable=True) if part.need_to_restock()] + context['to_build'] = [part for part in Part.objects.filter(assembly=True) if part.need_to_restock()] return context diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index acfb02144d..d0beee54ce 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -129,8 +129,8 @@ class PartList(generics.ListCreateAPIView): filter_fields = [ 'is_template', 'variant_of', - 'buildable', - 'consumable', + 'assembly', + 'component', 'trackable', 'purchaseable', 'salable', diff --git a/InvenTree/part/fixtures/part.yaml b/InvenTree/part/fixtures/part.yaml index 632a265e23..7d669cf49d 100644 --- a/InvenTree/part/fixtures/part.yaml +++ b/InvenTree/part/fixtures/part.yaml @@ -57,5 +57,5 @@ fields: name: 'Bob' description: 'Can we build it?' - buildable: true + assembly: true \ No newline at end of file diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index a2ec613429..841622b865 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -101,8 +101,8 @@ class EditPartForm(HelperForm): 'default_supplier', 'units', 'minimum_stock', - 'buildable', - 'consumable', + 'assembly', + 'component', 'trackable', 'purchaseable', 'salable', diff --git a/InvenTree/part/migrations/0007_auto_20190602_1944.py b/InvenTree/part/migrations/0007_auto_20190602_1944.py new file mode 100644 index 0000000000..9bfeb7fb8d --- /dev/null +++ b/InvenTree/part/migrations/0007_auto_20190602_1944.py @@ -0,0 +1,42 @@ +# Generated by Django 2.2 on 2019-06-02 09:44 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('part', '0006_auto_20190526_1215'), + ] + + operations = [ + migrations.RemoveField( + model_name='part', + name='buildable', + ), + migrations.RemoveField( + model_name='part', + name='consumable', + ), + migrations.AddField( + model_name='part', + name='assembly', + field=models.BooleanField(default=False, help_text='Can this part be built from other parts?', verbose_name='Assembly'), + ), + migrations.AddField( + model_name='part', + name='component', + field=models.BooleanField(default=True, help_text='Can this part be used to build other parts?', verbose_name='Component'), + ), + migrations.AlterField( + model_name='bomitem', + name='part', + field=models.ForeignKey(help_text='Select parent part', limit_choices_to={'active': True, 'assembly': True}, on_delete=django.db.models.deletion.CASCADE, related_name='bom_items', to='part.Part'), + ), + migrations.AlterField( + model_name='bomitem', + name='sub_part', + field=models.ForeignKey(help_text='Select part to be used in BOM', limit_choices_to={'active': True, 'component': True}, on_delete=django.db.models.deletion.CASCADE, related_name='used_in', to='part.Part'), + ), + ] diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index 048330c2c6..fa6f40915f 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -201,8 +201,8 @@ class Part(models.Model): minimum_stock: Minimum preferred quantity to keep in stock units: Units of measure for this part (default='pcs') salable: Can this part be sold to customers? - buildable: Can this part be build from other parts? - consumable: Can this part be used to make other parts? + assembly: Can this part be build from other parts? + component: Can this part be used to make other parts? purchaseable: Can this part be purchased from suppliers? trackable: Trackable parts can have unique serial numbers assigned, etc, etc active: Is this part active? Parts are deactivated instead of being deleted @@ -343,9 +343,9 @@ class Part(models.Model): units = models.CharField(max_length=20, default="pcs", blank=True, help_text='Stock keeping units for this part') - buildable = models.BooleanField(default=False, help_text='Can this part be built from other parts?') + assembly = models.BooleanField(default=False, verbose_name='Assembly', help_text='Can this part be built from other parts?') - consumable = models.BooleanField(default=True, help_text='Can this part be used to build other parts?') + component = models.BooleanField(default=True, verbose_name='Component', help_text='Can this part be used to build other parts?') trackable = models.BooleanField(default=False, help_text='Does this part have tracking for unique items?') @@ -858,7 +858,7 @@ class BomItem(models.Model): part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='bom_items', help_text='Select parent part', limit_choices_to={ - 'buildable': True, + 'assembly': True, 'active': True, }) @@ -867,7 +867,7 @@ class BomItem(models.Model): sub_part = models.ForeignKey(Part, on_delete=models.CASCADE, related_name='used_in', help_text='Select part to be used in BOM', limit_choices_to={ - 'consumable': True, + 'component': True, 'active': True }) diff --git a/InvenTree/part/serializers.py b/InvenTree/part/serializers.py index fe858091c7..224e41cd97 100644 --- a/InvenTree/part/serializers.py +++ b/InvenTree/part/serializers.py @@ -94,8 +94,8 @@ class PartSerializer(serializers.ModelSerializer): # 'available_stock', 'units', 'trackable', - 'buildable', - 'consumable', + 'assembly', + 'component', 'trackable', 'salable', 'active', diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 4522d47236..b536a5542e 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -100,13 +100,13 @@
Assembly | This part can be assembled from other parts | ||
Component | This part can be used in assemblies | diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html index d8af6d2ec9..1354a9a4a4 100644 --- a/InvenTree/part/templates/part/part_base.html +++ b/InvenTree/part/templates/part/part_base.html @@ -78,7 +78,7 @@In Stock | {{ part.total_stock }} |
Can Build | {{ part.can_build }} | diff --git a/InvenTree/part/templates/part/tabs.html b/InvenTree/part/templates/part/tabs.html index 53a551f36c..dd5034040d 100644 --- a/InvenTree/part/templates/part/tabs.html +++ b/InvenTree/part/templates/part/tabs.html @@ -15,13 +15,13 @@ Allocated {{ part.allocation_count }} {% endif %} - {% if part.buildable %} + {% if part.assembly %}