diff --git a/InvenTree/build/api.py b/InvenTree/build/api.py index 779c248fe5..81bcbaf001 100644 --- a/InvenTree/build/api.py +++ b/InvenTree/build/api.py @@ -47,6 +47,8 @@ class BuildList(generics.ListCreateAPIView): 'target_date', 'completion_date', 'quantity', + 'issued_by', + 'responsible', ] search_fields = [ diff --git a/InvenTree/build/serializers.py b/InvenTree/build/serializers.py index e33fcb6c7f..363614035a 100644 --- a/InvenTree/build/serializers.py +++ b/InvenTree/build/serializers.py @@ -10,11 +10,12 @@ from django.db.models import BooleanField from rest_framework import serializers -from InvenTree.serializers import InvenTreeModelSerializer, InvenTreeAttachmentSerializerField +from InvenTree.serializers import InvenTreeModelSerializer, InvenTreeAttachmentSerializerField, UserSerializerBrief from stock.serializers import StockItemSerializerBrief from stock.serializers import LocationSerializer from part.serializers import PartSerializer, PartBriefSerializer +from users.serializers import OwnerSerializer from .models import Build, BuildItem, BuildOrderAttachment @@ -31,6 +32,10 @@ class BuildSerializer(InvenTreeModelSerializer): overdue = serializers.BooleanField(required=False, read_only=True) + issued_by_detail = UserSerializerBrief(source='issued_by', read_only=True) + + responsible_detail = OwnerSerializer(source='responsible', read_only=True) + @staticmethod def annotate_queryset(queryset): """ @@ -84,6 +89,10 @@ class BuildSerializer(InvenTreeModelSerializer): 'target_date', 'notes', 'link', + 'issued_by', + 'issued_by_detail', + 'responsible', + 'responsible_detail', ] read_only_fields = [ diff --git a/InvenTree/templates/js/build.js b/InvenTree/templates/js/build.js index 7b72149ec9..67961d1b73 100644 --- a/InvenTree/templates/js/build.js +++ b/InvenTree/templates/js/build.js @@ -876,6 +876,36 @@ function loadBuildTable(table, options) { title: '{% trans "Created" %}', sortable: true, }, + { + field: 'issued_by', + title: '{% trans "Issued by" %}', + sortable: true, + formatter: function(value, row, index, field) { + if (value) + { + return row.issued_by_detail.username; + } + else + { + return '{% trans "No user information" %}'; + } + } + }, + { + field: 'responsible', + title: '{% trans "Resposible" %}', + sortable: true, + formatter: function(value, row, index, field) { + if (value) + { + return row.responsible_detail.name; + } + else + { + return '{% trans "No information" %}'; + } + } + }, { field: 'target_date', title: '{% trans "Target Date" %}',