mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1749 from matmair/extend-build-order
Extend build order table
This commit is contained in:
commit
c2df1fcd95
@ -47,6 +47,8 @@ class BuildList(generics.ListCreateAPIView):
|
|||||||
'target_date',
|
'target_date',
|
||||||
'completion_date',
|
'completion_date',
|
||||||
'quantity',
|
'quantity',
|
||||||
|
'issued_by',
|
||||||
|
'responsible',
|
||||||
]
|
]
|
||||||
|
|
||||||
search_fields = [
|
search_fields = [
|
||||||
|
@ -10,11 +10,12 @@ from django.db.models import BooleanField
|
|||||||
|
|
||||||
from rest_framework import serializers
|
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 StockItemSerializerBrief
|
||||||
from stock.serializers import LocationSerializer
|
from stock.serializers import LocationSerializer
|
||||||
from part.serializers import PartSerializer, PartBriefSerializer
|
from part.serializers import PartSerializer, PartBriefSerializer
|
||||||
|
from users.serializers import OwnerSerializer
|
||||||
|
|
||||||
from .models import Build, BuildItem, BuildOrderAttachment
|
from .models import Build, BuildItem, BuildOrderAttachment
|
||||||
|
|
||||||
@ -31,6 +32,10 @@ class BuildSerializer(InvenTreeModelSerializer):
|
|||||||
|
|
||||||
overdue = serializers.BooleanField(required=False, read_only=True)
|
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
|
@staticmethod
|
||||||
def annotate_queryset(queryset):
|
def annotate_queryset(queryset):
|
||||||
"""
|
"""
|
||||||
@ -84,6 +89,10 @@ class BuildSerializer(InvenTreeModelSerializer):
|
|||||||
'target_date',
|
'target_date',
|
||||||
'notes',
|
'notes',
|
||||||
'link',
|
'link',
|
||||||
|
'issued_by',
|
||||||
|
'issued_by_detail',
|
||||||
|
'responsible',
|
||||||
|
'responsible_detail',
|
||||||
]
|
]
|
||||||
|
|
||||||
read_only_fields = [
|
read_only_fields = [
|
||||||
|
@ -876,6 +876,36 @@ function loadBuildTable(table, options) {
|
|||||||
title: '{% trans "Created" %}',
|
title: '{% trans "Created" %}',
|
||||||
sortable: true,
|
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',
|
field: 'target_date',
|
||||||
title: '{% trans "Target Date" %}',
|
title: '{% trans "Target Date" %}',
|
||||||
|
Loading…
Reference in New Issue
Block a user