2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 19:45:46 +00:00

Client-side grouping

- Cusomizations made to bootstrap-table-group-by.js
- Group by part name
- Display total stock count per group
- Only group if there are more than 1 item in the group
- Groups send checkbox signals through appropriately!
This commit is contained in:
Oliver Walters
2019-05-28 17:21:29 +10:00
parent 64403f824a
commit 4218cf8b45
5 changed files with 305 additions and 3 deletions

View File

@ -183,6 +183,9 @@ class StockItem(models.Model):
def get_absolute_url(self):
return reverse('stock-item-detail', kwargs={'pk': self.id})
def get_part_name(self):
return self.part.full_name
class Meta:
unique_together = [
('part', 'serial'),

View File

@ -57,6 +57,8 @@ class StockItemSerializer(serializers.ModelSerializer):
url = serializers.CharField(source='get_absolute_url', read_only=True)
status_text = serializers.CharField(source='get_status_display', read_only=True)
part_name = serializers.CharField(source='get_part_name', read_only=True)
part_detail = PartBriefSerializer(source='part', many=False, read_only=True)
location_detail = LocationBriefSerializer(source='location', many=False, read_only=True)
@ -79,6 +81,7 @@ class StockItemSerializer(serializers.ModelSerializer):
'pk',
'url',
'part',
'part_name',
'part_detail',
'supplier_part',
'location',