fix pos inventory serializer context rancher key

This commit is contained in:
2025-08-30 10:47:16 +03:30
parent 5b0d6ac8ee
commit 91f69c171b

View File

@@ -57,14 +57,14 @@ class InventoryEntrySerializer(serializers.ModelSerializer):
'id': instance.distribution.quota.product.id,
}
if self.context['rancher']:
if 'rancher' in self.context.keys():
# 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
)
# rancher live stock statistics by inventory entry
representation['rancher_quota_weight_statistics'] = rancher_quota_weight(
self.context['rancher'], instance
)
return representation