add purchace limitations system for rancher - add incentive plans to rancher entries data
This commit is contained in:
@@ -22,10 +22,25 @@ def quota_live_stock_allocation_info(quota: Quota) -> typing.Any:
|
||||
|
||||
allocations = quota.livestock_allocations.filter(quota=quota)
|
||||
|
||||
allocations_list = [{
|
||||
"name": alloc.livestock_type.name,
|
||||
"quantity": alloc.quantity_kg
|
||||
} for alloc in allocations]
|
||||
if allocations:
|
||||
allocations_list = [{
|
||||
"name": alloc.livestock_type.name,
|
||||
"quantity": alloc.quantity_kg
|
||||
} for alloc in allocations]
|
||||
|
||||
return allocations_list
|
||||
return allocations_list
|
||||
|
||||
|
||||
def quota_incentive_plans_info(quota: Quota) -> typing.Any:
|
||||
""" information of quota incentive plans """
|
||||
|
||||
incentive_plans = quota.incentive_assignments.all()
|
||||
|
||||
if incentive_plans:
|
||||
incentive_plans_list = [{
|
||||
'name': plan.incentive_plan.name,
|
||||
'heavy_value': plan.heavy_value,
|
||||
'light_value': plan.light_value
|
||||
} for plan in incentive_plans]
|
||||
|
||||
return incentive_plans_list
|
||||
|
||||
Reference in New Issue
Block a user