fix bug of rancher plan id
This commit is contained in:
@@ -84,7 +84,7 @@ def rancher_quota_weight(rancher, inventory_entry: InventoryEntry = None, distri
|
|||||||
'rancher',
|
'rancher',
|
||||||
'livestock_type'
|
'livestock_type'
|
||||||
).filter(rancher=rancher, livestock_type=item.livestock_type)
|
).filter(rancher=rancher, livestock_type=item.livestock_type)
|
||||||
if rancher_plans:
|
if rancher_plans.exists():
|
||||||
# multiple count of rancher livestock on incentive plan &
|
# multiple count of rancher livestock on incentive plan &
|
||||||
# incentive plan quantity by this livestock type
|
# incentive plan quantity by this livestock type
|
||||||
rancher_plan_weight = rancher_plans.first().allowed_quantity * item.quantity_kg
|
rancher_plan_weight = rancher_plans.first().allowed_quantity * item.quantity_kg
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ def quota_incentive_plans_info(quota: Quota, rancher: Rancher) -> typing.Any:
|
|||||||
).filter(rancher=rancher, livestock_type=plan.livestock_type)
|
).filter(rancher=rancher, livestock_type=plan.livestock_type)
|
||||||
|
|
||||||
incentive_plans_data = {
|
incentive_plans_data = {
|
||||||
'id': rancher_plan.first().allowed_quantity,
|
'id': rancher_plan.first().allowed_quantity if rancher_plan.exists() else None,
|
||||||
'name': plan.incentive_plan.name,
|
'name': plan.incentive_plan.name,
|
||||||
'livestock_type': plan.livestock_type.name if plan.livestock_type else "",
|
'livestock_type': plan.livestock_type.name if plan.livestock_type else "",
|
||||||
'livestock_type_en': plan.livestock_type.en_name if plan.livestock_type else "",
|
'livestock_type_en': plan.livestock_type.en_name if plan.livestock_type else "",
|
||||||
|
|||||||
Reference in New Issue
Block a user