Display number of supplier parts in supplier list

This commit is contained in:
Oliver Walters 2019-05-16 22:29:39 +10:00
parent 5ebc7b040a
commit b77b6d2256
2 changed files with 27 additions and 2 deletions

View File

@ -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'
]

View File

@ -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' %}"
});