diff --git a/InvenTree/company/serializers.py b/InvenTree/company/serializers.py index 88792f7f64..2967dbebd5 100644 --- a/InvenTree/company/serializers.py +++ b/InvenTree/company/serializers.py @@ -25,7 +25,25 @@ class CompanySerializer(serializers.ModelSerializer): """ Serializer for Company object (full detail) """ url = serializers.CharField(source='get_absolute_url', read_only=True) + part_count = serializers.CharField(read_only=True) class Meta: model = Company - fields = '__all__' + fields = [ + 'id', + 'url', + 'name', + 'description', + 'website', + 'name', + 'phone', + 'address', + 'email', + 'contact', + 'URL', + 'image', + 'notes', + 'is_customer', + 'is_supplier', + 'part_count' + ] diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html index d4a8659798..cea452fdc1 100644 --- a/InvenTree/company/templates/company/index.html +++ b/InvenTree/company/templates/company/index.html @@ -73,7 +73,14 @@ InvenTree | Supplier List } return ''; } - } + }, + { + field: 'part_count', + title: 'Parts', + formatter: function(value, row, index, field) { + return renderLink(value, row.url + 'parts/'); + } + }, ], url: "{% url 'api-company-list' %}" });