add some new fields to quota sale transaction model - add rancher information about live stocks & quota aalocations information
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user