add weight types to live stovk types

This commit is contained in:
2025-07-14 12:14:22 +03:30
parent a5ce81efe7
commit 1b5b85a663
3 changed files with 44 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
# Generated by Django 5.0 on 2025-07-14 08:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0043_quota_sale_license'),
]
operations = [
migrations.RemoveField(
model_name='quotalivestockallocation',
name='livestock_type',
),
]

View File

@@ -0,0 +1,20 @@
# Generated by Django 5.0 on 2025-07-14 08:25
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('livestock', '0012_livestocktype_weight_type'),
('product', '0044_remove_quotalivestockallocation_livestock_type'),
]
operations = [
migrations.AddField(
model_name='quotalivestockallocation',
name='livestock_type',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='allocations', to='livestock.livestocktype'),
),
]

View File

@@ -5,6 +5,7 @@ from apps.core.models import BaseModel
from apps.authorization.models import UserRelations
from apps.authentication.models import Organization
from django.contrib.postgres.fields import ArrayField
from apps.livestock.models import LiveStockType
from datetime import datetime
import jdatetime
@@ -428,7 +429,12 @@ class QuotaLivestockAllocation(BaseModel):
null=True
)
livestock_group = models.CharField(max_length=20, choices=LivestockGroup.choices, null=True)
livestock_type = models.CharField(max_length=20, choices=LivestockType.choices, null=True)
livestock_type = models.ForeignKey(
LiveStockType,
on_delete=models.CASCADE,
related_name='allocations',
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)