mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Ordering and rendering for StockLocation
This commit is contained in:
parent
36cf614aed
commit
753fe9c80f
@ -363,6 +363,15 @@ class StockLocationList(generics.ListCreateAPIView):
|
||||
ordering_fields = [
|
||||
'name',
|
||||
'items',
|
||||
'level',
|
||||
'tree_id',
|
||||
'lft',
|
||||
]
|
||||
|
||||
ordering = [
|
||||
'tree_id',
|
||||
'lft',
|
||||
'name',
|
||||
]
|
||||
|
||||
|
||||
|
@ -260,12 +260,15 @@ class LocationSerializer(InvenTreeModelSerializer):
|
||||
|
||||
items = serializers.IntegerField(source='item_count', read_only=True)
|
||||
|
||||
level = serializers.IntegerField(read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = StockLocation
|
||||
fields = [
|
||||
'pk',
|
||||
'url',
|
||||
'name',
|
||||
'level',
|
||||
'description',
|
||||
'parent',
|
||||
'pathstring',
|
||||
|
@ -67,7 +67,9 @@ function renderStockItem(name, data, parameters, options) {
|
||||
// Renderer for "StockLocation" model
|
||||
function renderStockLocation(name, data, parameters, options) {
|
||||
|
||||
var html = `<span>${data.name}</span>`;
|
||||
var level = '-'.repeat(data.level);
|
||||
|
||||
var html = `<span>${level} ${data.pathstring}</span>`;
|
||||
|
||||
if (data.description) {
|
||||
html += ` - <i>${data.description}</i>`;
|
||||
@ -75,10 +77,6 @@ function renderStockLocation(name, data, parameters, options) {
|
||||
|
||||
html += `<span class='float-right'>{% trans "Location ID" %}: ${data.pk}</span>`;
|
||||
|
||||
if (data.pathstring) {
|
||||
html += `<p><small>${data.pathstring}</small></p>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user