diff --git a/InvenTree/InvenTree/api_version.py b/InvenTree/InvenTree/api_version.py index 3265a258ac..fc42c67ccc 100644 --- a/InvenTree/InvenTree/api_version.py +++ b/InvenTree/InvenTree/api_version.py @@ -2,10 +2,12 @@ # InvenTree API version -INVENTREE_API_VERSION = 87 +INVENTREE_API_VERSION = 88 """ Increment this API version number whenever there is a significant change to the API that any clients need to know about +v88 -> 2023-01-17: https://github.com/inventree/InvenTree/pull/4225 + - Adds 'priority' field to Build model and api endpoints v87 -> 2023-01-04 : https://github.com/inventree/InvenTree/pull/4067 - Add API date filter for stock table on Expiry date diff --git a/InvenTree/build/api.py b/InvenTree/build/api.py index 557dde30d9..9fda2c3065 100644 --- a/InvenTree/build/api.py +++ b/InvenTree/build/api.py @@ -101,6 +101,7 @@ class BuildList(APIDownloadMixin, ListCreateAPI): 'completed', 'issued_by', 'responsible', + 'priority', ] ordering_field_aliases = { @@ -115,6 +116,7 @@ class BuildList(APIDownloadMixin, ListCreateAPI): 'part__name', 'part__IPN', 'part__description', + 'priority', ] def get_queryset(self): diff --git a/InvenTree/build/migrations/0037_build_priority.py b/InvenTree/build/migrations/0037_build_priority.py new file mode 100644 index 0000000000..782e29501b --- /dev/null +++ b/InvenTree/build/migrations/0037_build_priority.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.16 on 2023-01-17 20:37 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('build', '0036_auto_20220707_1101'), + ] + + operations = [ + migrations.AddField( + model_name='build', + name='priority', + field=models.PositiveIntegerField(default=0, help_text='Priority of this build order', validators=[django.core.validators.MinValueValidator(0)], verbose_name='Build Priority'), + ), + ] diff --git a/InvenTree/build/models.py b/InvenTree/build/models.py index 9c67d54e0d..2fa1b7cb25 100644 --- a/InvenTree/build/models.py +++ b/InvenTree/build/models.py @@ -61,6 +61,7 @@ class Build(MPTTModel, ReferenceIndexingMixin): completed_by: User that completed the build issued_by: User that issued the build responsible: User (or group) responsible for completing the build + priority: Priority of the build """ OVERDUE_FILTER = Q(status__in=BuildStatus.ACTIVE_CODES) & ~Q(target_date=None) & Q(target_date__lte=datetime.now().date()) @@ -294,6 +295,13 @@ class Build(MPTTModel, ReferenceIndexingMixin): help_text=_('Extra build notes') ) + priority = models.PositiveIntegerField( + verbose_name=_('Build Priority'), + default=0, + validators=[MinValueValidator(0)], + help_text=_('Priority of this build order') + ) + def sub_builds(self, cascade=True): """Return all Build Order objects under this one.""" if cascade: diff --git a/InvenTree/build/serializers.py b/InvenTree/build/serializers.py index 48d8b92368..1f2844bda8 100644 --- a/InvenTree/build/serializers.py +++ b/InvenTree/build/serializers.py @@ -112,6 +112,7 @@ class BuildSerializer(InvenTreeModelSerializer): 'issued_by_detail', 'responsible', 'responsible_detail', + 'priority', ] read_only_fields = [ diff --git a/InvenTree/build/templates/build/build_base.html b/InvenTree/build/templates/build/build_base.html index 3bea18fe03..01aae6e573 100644 --- a/InvenTree/build/templates/build/build_base.html +++ b/InvenTree/build/templates/build/build_base.html @@ -194,6 +194,13 @@ src="{% static 'img/blank_image.png' %}"