mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
[FR] Add "priority" field to BuildOrder (#4225)
* [FR] Add "priority" field to BuildOrder Fixes #3059 * Add priority to the frontend * add field to serializer * bump version
This commit is contained in:
parent
61e5244789
commit
428e939b1d
@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
|
|
||||||
# InvenTree API version
|
# 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
|
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
|
v87 -> 2023-01-04 : https://github.com/inventree/InvenTree/pull/4067
|
||||||
- Add API date filter for stock table on Expiry date
|
- Add API date filter for stock table on Expiry date
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ class BuildList(APIDownloadMixin, ListCreateAPI):
|
|||||||
'completed',
|
'completed',
|
||||||
'issued_by',
|
'issued_by',
|
||||||
'responsible',
|
'responsible',
|
||||||
|
'priority',
|
||||||
]
|
]
|
||||||
|
|
||||||
ordering_field_aliases = {
|
ordering_field_aliases = {
|
||||||
@ -115,6 +116,7 @@ class BuildList(APIDownloadMixin, ListCreateAPI):
|
|||||||
'part__name',
|
'part__name',
|
||||||
'part__IPN',
|
'part__IPN',
|
||||||
'part__description',
|
'part__description',
|
||||||
|
'priority',
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
19
InvenTree/build/migrations/0037_build_priority.py
Normal file
19
InvenTree/build/migrations/0037_build_priority.py
Normal file
@ -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'),
|
||||||
|
),
|
||||||
|
]
|
@ -61,6 +61,7 @@ class Build(MPTTModel, ReferenceIndexingMixin):
|
|||||||
completed_by: User that completed the build
|
completed_by: User that completed the build
|
||||||
issued_by: User that issued the build
|
issued_by: User that issued the build
|
||||||
responsible: User (or group) responsible for completing 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())
|
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')
|
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):
|
def sub_builds(self, cascade=True):
|
||||||
"""Return all Build Order objects under this one."""
|
"""Return all Build Order objects under this one."""
|
||||||
if cascade:
|
if cascade:
|
||||||
|
@ -112,6 +112,7 @@ class BuildSerializer(InvenTreeModelSerializer):
|
|||||||
'issued_by_detail',
|
'issued_by_detail',
|
||||||
'responsible',
|
'responsible',
|
||||||
'responsible_detail',
|
'responsible_detail',
|
||||||
|
'priority',
|
||||||
]
|
]
|
||||||
|
|
||||||
read_only_fields = [
|
read_only_fields = [
|
||||||
|
@ -194,6 +194,13 @@ src="{% static 'img/blank_image.png' %}"
|
|||||||
<td>{{ build.responsible }}</td>
|
<td>{{ build.responsible }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if build.priority != 0 %}
|
||||||
|
<tr>
|
||||||
|
<td><span class="fa-solid fa-arrow-up-9-1"></span></td>
|
||||||
|
<td>{% trans "Priority" %}</td>
|
||||||
|
<td>{{ build.priority }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -88,6 +88,13 @@
|
|||||||
<td><a href="{% url 'build-detail' build.parent.id %}">{{ build.parent }}</a>{% include "clip.html"%}</td>
|
<td><a href="{% url 'build-detail' build.parent.id %}">{{ build.parent }}</a>{% include "clip.html"%}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if build.priority != 0 %}
|
||||||
|
<tr>
|
||||||
|
<td><span class="fa-solid fa-arrow-up-9-1"></span></td>
|
||||||
|
<td>{% trans "Priority" %}</td>
|
||||||
|
<td>{{ build.priority }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
{% if build.sales_order %}
|
{% if build.sales_order %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-dolly'></span></td>
|
<td><span class='fas fa-dolly'></span></td>
|
||||||
|
@ -46,6 +46,7 @@ function buildFormFields() {
|
|||||||
},
|
},
|
||||||
title: {},
|
title: {},
|
||||||
quantity: {},
|
quantity: {},
|
||||||
|
priority: {},
|
||||||
parent: {
|
parent: {
|
||||||
filters: {
|
filters: {
|
||||||
part_detail: true,
|
part_detail: true,
|
||||||
@ -2596,6 +2597,12 @@ function loadBuildTable(table, options) {
|
|||||||
title: '{% trans "Description" %}',
|
title: '{% trans "Description" %}',
|
||||||
switchable: true,
|
switchable: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'priority',
|
||||||
|
title: '{% trans "Priority" %}',
|
||||||
|
switchable: true,
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'part',
|
field: 'part',
|
||||||
title: '{% trans "Part" %}',
|
title: '{% trans "Part" %}',
|
||||||
|
Loading…
Reference in New Issue
Block a user