add some new fields to quota sale transaction model - add rancher information about live stocks & quota aalocations information

This commit is contained in:
2025-08-25 16:34:48 +03:30
parent 2725bc5077
commit 4146a66950
7 changed files with 138 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
from apps.herd.services.services import get_rancher_statistics, rancher_quota_weight
from apps.product.services.services import quota_live_stock_allocation_info
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 (
@@ -14,6 +15,7 @@ class InventoryEntrySerializer(serializers.ModelSerializer):
model = warehouse_models.InventoryEntry
fields = [
"id",
"entry_identity",
"create_date",
"modify_date",
"organization",
@@ -42,6 +44,9 @@ class InventoryEntrySerializer(serializers.ModelSerializer):
representation['quota'] = {
'quota_identity': instance.distribution.quota.quota_id,
'quota_weight': instance.distribution.quota.quota_weight,
'quota_livestock_allocations': quota_live_stock_allocation_info(
instance.distribution.quota
)
}
representation['product'] = {
'name': instance.distribution.quota.product.name,