add rancher statistics to inventory entries list - fix bug of login for empty string device identity
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from apps.herd.services.services import get_rancher_statistics, rancher_quota_weight
|
||||
from apps.pos_device.pos.api.v1.serializers.device import DeviceSerializer
|
||||
from apps.herd.pos.api.v1.serializers import RancherSerializer
|
||||
from apps.warehouse.exceptions import (
|
||||
@@ -47,6 +48,14 @@ class InventoryEntrySerializer(serializers.ModelSerializer):
|
||||
'id': instance.distribution.quota.product.id,
|
||||
}
|
||||
|
||||
# rancher herd & live stock statistics
|
||||
representation['rancher_statistics'] = get_rancher_statistics(self.context['rancher'])
|
||||
|
||||
# rancher live stock statistics by inventory entry
|
||||
representation['rancher_quota_weight_statistics'] = rancher_quota_weight(
|
||||
self.context['rancher'], instance
|
||||
)
|
||||
|
||||
return representation
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user