Merge pull request #1834 from SchrodingersGat/add-line-item-fix

Add 'destination' field to POLineItem API serializer
This commit is contained in:
Oliver 2021-07-18 21:41:29 +10:00 committed by GitHub
commit 14e2cabffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -132,7 +132,7 @@ class POLineItemSerializer(InvenTreeModelSerializer):
purchase_price_string = serializers.CharField(source='purchase_price', read_only=True)
destination = LocationBriefSerializer(source='get_destination', read_only=True)
destination_detail = LocationBriefSerializer(source='get_destination', read_only=True)
purchase_price_currency = serializers.ChoiceField(
choices=currency_code_mappings(),
@ -156,6 +156,7 @@ class POLineItemSerializer(InvenTreeModelSerializer):
'purchase_price_currency',
'purchase_price_string',
'destination',
'destination_detail',
]

View File

@ -401,8 +401,15 @@ $("#po-table").inventreeTable({
}
},
{
field: 'destination.pathstring',
field: 'destination',
title: '{% trans "Destination" %}',
formatter: function(value, row) {
if (value) {
return renderLink(row.destination_detail.pathstring, `/stock/location/${value}/`);
} else {
return '-';
}
}
},
{
field: 'notes',