diff --git a/InvenTree/build/migrations/0025_auto_20201020_1248.py b/InvenTree/build/migrations/0025_auto_20201020_1248.py new file mode 100644 index 0000000000..ecc0b73ac9 --- /dev/null +++ b/InvenTree/build/migrations/0025_auto_20201020_1248.py @@ -0,0 +1,24 @@ +# Generated by Django 3.0.7 on 2020-10-20 12:48 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('build', '0024_auto_20201020_1144'), + ] + + operations = [ + migrations.AddField( + model_name='build', + name='completed', + field=models.PositiveIntegerField(default=0, help_text='Number of stock items which have been completed', verbose_name='Completed items'), + ), + migrations.AlterField( + model_name='build', + name='quantity', + field=models.PositiveIntegerField(default=1, help_text='Number of stock items to build', validators=[django.core.validators.MinValueValidator(1)], verbose_name='Build Quantity'), + ), + ] diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 3ee6aad426..a22aae196f 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -62,21 +62,6 @@ class Build(MPTTModel): def get_absolute_url(self): return reverse('build-detail', kwargs={'pk': self.id}) - - def clean(self): - """ - Validation for Build object. - """ - - super().clean() - - # Build quantity must be an integer - # Maybe in the future this will be adjusted? - - if not self.quantity == int(self.quantity): - raise ValidationError({ - 'quantity': _("Build quantity must be integer value for trackable parts") - }) reference = models.CharField( unique=True, @@ -149,7 +134,13 @@ class Build(MPTTModel): verbose_name=_('Build Quantity'), default=1, validators=[MinValueValidator(1)], - help_text=_('Number of parts to build') + help_text=_('Number of stock items to build') + ) + + completed = models.PositiveIntegerField( + verbose_name=_('Completed items'), + default=0, + help_text=_('Number of stock items which have been completed') ) status = models.PositiveIntegerField( diff --git a/InvenTree/build/serializers.py b/InvenTree/build/serializers.py index 53e75942f0..6367673ce9 100644 --- a/InvenTree/build/serializers.py +++ b/InvenTree/build/serializers.py @@ -38,6 +38,7 @@ class BuildSerializer(InvenTreeModelSerializer): 'url', 'title', 'creation_date', + 'completed', 'completion_date', 'part', 'part_detail', @@ -51,9 +52,10 @@ class BuildSerializer(InvenTreeModelSerializer): ] read_only_fields = [ - 'status', + 'completed', 'creation_date', 'completion_data', + 'status', 'status_text', ] diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html index a366459908..3a94398e87 100644 --- a/InvenTree/build/templates/build/build_base.html +++ b/InvenTree/build/templates/build/build_base.html @@ -68,11 +68,6 @@ src="{% static 'img/blank_image.png' %}"
- | {% trans "Build Order Reference" %} | -{{ build }} | -|
{% trans "Part" %} | @@ -88,6 +83,11 @@ src="{% static 'img/blank_image.png' %}"{% trans "Status" %} | {% build_status_label build.status %} | |
+ | {% trans "Progress" %} | +{{ build.completed }} / {{ build.quantity }} | +|
@@ -102,20 +102,6 @@ src="{% static 'img/blank_image.png' %}" | {{ build.sales_order }} | ||
- | {% trans "BOM Price" %} | -
- {% if bom_price %}
- {{ bom_price }}
- {% if build.part.has_complete_bom_pricing == False %}
- {% trans "BOM pricing is incomplete" %} - {% endif %} - {% else %} - {% trans "No pricing information" %} - {% endif %} - |
-
- | {% trans "Title" %} | -{{ build.title }} | -|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- | {% trans "Part" %} | -{{ build.part.full_name }} | -|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- | {% trans "Quantity" %} | {{ build.quantity }} | -|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- | {% trans "Stock Source" %} | -
- {% if build.take_from %}
- {{ build.take_from }}
- {% else %}
- {% trans "Stock can be taken from any available location." %}
+
+
+
+ | {% trans "External Link" %} |
+ {{ build.link }} |
+
+ | {% trans "Created" %} |
+ {{ build.creation_date }} |
+ |
+ | {% trans "BOM Price" %} | +
+ {% if bom_price %}
+ {{ bom_price }}
+ {% if build.part.has_complete_bom_pricing == False %}
+ {% trans "BOM pricing is incomplete" %} + {% endif %} + {% else %} + {% trans "No pricing information" %} + {% endif %} + |
+
+ | {% trans "Enough Parts?" %} | ++ {% if build.can_build %} + {% trans "Yes" %} + {% else %} + {% trans "No" %} + {% endif %} + | +
+ | {% trans "Completed" %} | +{{ build.completion_date }}{% if build.completed_by %}{{ build.completed_by }}{% endif %} | +