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,6 @@
from apps.product.models import Quota, QuotaLivestockAllocation
from apps.warehouse.models import InventoryEntry
import typing
def get_products_in_warehouse(organization_id):
@@ -14,3 +16,16 @@ def get_products_in_warehouse(organization_id):
return list(set(product_objects))
def quota_live_stock_allocation_info(quota: Quota) -> typing.Any:
""" information of quota live stock allocations """
allocations = quota.livestock_allocations.filter(quota=quota)
allocations_list = [{
"name": alloc.livestock_type.name,
"quantity": alloc.quantity_kg
} for alloc in allocations]
return allocations_list