From ebcbf9a90edcb97d805b7ba5d4ed107e46dae31d Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 17 Apr 2019 23:33:19 +1000 Subject: [PATCH] Add status_text to API --- InvenTree/build/serializers.py | 3 +++ InvenTree/static/script/inventree/stock.js | 2 +- InvenTree/stock/serializers.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/InvenTree/build/serializers.py b/InvenTree/build/serializers.py index f28c9fcf89..ac36fd5b41 100644 --- a/InvenTree/build/serializers.py +++ b/InvenTree/build/serializers.py @@ -9,6 +9,7 @@ from .models import Build class BuildSerializer(serializers.ModelSerializer): url = serializers.CharField(source='get_absolute_url', read_only=True) + status_text = serializers.CharField(source='get_status_display', read_only=True) class Meta: model = Build @@ -20,4 +21,6 @@ class BuildSerializer(serializers.ModelSerializer): 'completion_date', 'part', 'quantity', + 'status', + 'status_text', 'notes'] diff --git a/InvenTree/static/script/inventree/stock.js b/InvenTree/static/script/inventree/stock.js index de383867f1..c0a931cdbf 100644 --- a/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/static/script/inventree/stock.js @@ -365,7 +365,7 @@ function loadStockTable(modal, options) { sortable: true, formatter: function(value, row, index, field) { var text = renderLink(value, row.url); - text = text + "" + row.status + ""; + text = text + "" + row.status_text + ""; return text; } }, diff --git a/InvenTree/stock/serializers.py b/InvenTree/stock/serializers.py index 104737c437..f79ceaa3b1 100644 --- a/InvenTree/stock/serializers.py +++ b/InvenTree/stock/serializers.py @@ -63,6 +63,7 @@ class StockItemSerializer(serializers.ModelSerializer): part = PartBriefSerializer(many=False, read_only=True) location = LocationBriefSerializer(many=False, read_only=True) + status_text = serializers.CharField(source='get_status_display', read_only=True) class Meta: model = StockItem @@ -78,6 +79,7 @@ class StockItemSerializer(serializers.ModelSerializer): 'serial', 'batch', 'status', + 'status_text', 'notes', ]