add & fix - transaction dashboard / edit distribution with stat validation bug

This commit is contained in:
2025-11-26 09:52:14 +03:30
parent 552813edd5
commit d63aa36a19
7 changed files with 209 additions and 8 deletions

View File

@@ -81,12 +81,14 @@ def get_rancher_statistic_by_herd(rancher: Rancher = None) -> typing.Any:
def rancher_quota_weight(
rancher: Rancher,
inventory_entry: InventoryEntry = None,
distribution: QuotaDistribution = None
distribution: QuotaDistribution = None,
quota: Quota = None
):
"""
:param rancher: Rancher instance
:param inventory_entry: InventoryEntry instance
:param distribution: QuotaDistribution instance
:param quota: Quota instance
:return: dict {total, by_type}
"""
@@ -103,7 +105,7 @@ def rancher_quota_weight(
elif distribution:
quota: Quota = distribution.quota
else:
quota: Quota = Quota()
quota: Quota = quota
# list of quota live stock allocations
allocations = list(quota.livestock_allocations.all().select_related('livestock_type'))