diff --git a/apps/herd/services/services.py b/apps/herd/services/services.py index 04ca266..581636f 100644 --- a/apps/herd/services/services.py +++ b/apps/herd/services/services.py @@ -55,15 +55,15 @@ def rancher_quota_weight(rancher, inventory_entry: InventoryEntry): livestock_counts = get_rancher_statistics(rancher) - total_weight = Decimal(0) + total_weight = 0 details = {} for alloc in allocations: animal_type = alloc.livestock_type.name - per_head = Decimal(alloc.quantity_kg) + per_head = alloc.quantity_kg count = livestock_counts.get(live_stock_meta.get(animal_type), 0) - weight = per_head * Decimal(count) + weight = per_head * count details[animal_type] = weight total_weight += weight diff --git a/apps/product/migrations/0070_alter_quotalivestockallocation_quantity_kg.py b/apps/product/migrations/0070_alter_quotalivestockallocation_quantity_kg.py new file mode 100644 index 0000000..c0c1103 --- /dev/null +++ b/apps/product/migrations/0070_alter_quotalivestockallocation_quantity_kg.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0 on 2025-08-30 08:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('product', '0069_quota_group'), + ] + + operations = [ + migrations.AlterField( + model_name='quotalivestockallocation', + name='quantity_kg', + field=models.PositiveBigIntegerField(default=0), + ), + ] diff --git a/apps/product/models.py b/apps/product/models.py index dd3b1a6..1241704 100644 --- a/apps/product/models.py +++ b/apps/product/models.py @@ -497,7 +497,7 @@ class QuotaLivestockAllocation(BaseModel): null=True ) livestock_subtype = models.CharField(max_length=20, choices=LivestockSubtype.choices, null=True) - quantity_kg = models.DecimalField(max_digits=12, decimal_places=2, null=True) + quantity_kg = models.PositiveBigIntegerField(default=0) """ @using for set unique values between fields