optimize load balance for inventory list in pos - add new fields to stake holdes
This commit is contained in:
@@ -20,7 +20,7 @@ def get_products_in_warehouse(organization_id):
|
||||
def quota_live_stock_allocation_info(quota: Quota) -> typing.Any:
|
||||
""" information of quota live stock allocations """
|
||||
|
||||
allocations = quota.livestock_allocations.filter(quota=quota)
|
||||
allocations = quota.livestock_allocations.select_related('livestock_type')
|
||||
|
||||
if allocations:
|
||||
allocations_list = [{
|
||||
@@ -35,7 +35,7 @@ def quota_live_stock_allocation_info(quota: Quota) -> typing.Any:
|
||||
def quota_incentive_plans_info(quota: Quota) -> typing.Any:
|
||||
""" information of quota incentive plans """
|
||||
|
||||
incentive_plans = quota.incentive_assignments.all()
|
||||
incentive_plans = quota.incentive_assignments.select_related("livestock_type", "incentive_plan")
|
||||
|
||||
if incentive_plans:
|
||||
incentive_plans_list = [{
|
||||
@@ -48,3 +48,31 @@ def quota_incentive_plans_info(quota: Quota) -> typing.Any:
|
||||
} for plan in incentive_plans]
|
||||
|
||||
return incentive_plans_list
|
||||
|
||||
|
||||
def quota_brokers_value(quota: Quota) -> typing.Any:
|
||||
""" information of quota brokers with their quota value """
|
||||
|
||||
brokers = quota.broker_values.select_related("broker")
|
||||
|
||||
if brokers:
|
||||
broker_values_list = [{
|
||||
'name': broker.broker.name,
|
||||
'amount': broker.value
|
||||
} for broker in brokers]
|
||||
|
||||
return broker_values_list
|
||||
|
||||
|
||||
def quota_attribute_value(quota: Quota) -> typing.Any:
|
||||
""" information of quota pricing attribute values """
|
||||
|
||||
attributes = quota.attribute_values.select_related("attribute")
|
||||
|
||||
if attributes:
|
||||
attribute_values_list = [{
|
||||
'name': attr.attribute.name,
|
||||
'amount': attr.value
|
||||
}for attr in attributes]
|
||||
|
||||
return attribute_values_list
|
||||
|
||||
Reference in New Issue
Block a user