From 8015d9a9542dcff86a50ad11793af52fc71b9dac Mon Sep 17 00:00:00 2001 From: Mojtaba-z Date: Sat, 30 Aug 2025 12:54:07 +0330 Subject: [PATCH] add new fields to incentive assignment --- ...ntiveassignment_livestock_type_and_more.py | 25 +++++++++++++++++++ apps/product/models.py | 7 ++++++ 2 files changed, 32 insertions(+) create mode 100644 apps/product/migrations/0071_quotaincentiveassignment_livestock_type_and_more.py diff --git a/apps/product/migrations/0071_quotaincentiveassignment_livestock_type_and_more.py b/apps/product/migrations/0071_quotaincentiveassignment_livestock_type_and_more.py new file mode 100644 index 0000000..1de4aa2 --- /dev/null +++ b/apps/product/migrations/0071_quotaincentiveassignment_livestock_type_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 5.0 on 2025-08-30 09:22 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('livestock', '0013_livestock_archive'), + ('product', '0070_alter_quotalivestockallocation_quantity_kg'), + ] + + operations = [ + migrations.AddField( + model_name='quotaincentiveassignment', + name='livestock_type', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='incentive_plans', to='livestock.livestocktype'), + ), + migrations.AddField( + model_name='quotaincentiveassignment', + name='quantity_kg', + field=models.PositiveBigIntegerField(default=0), + ), + ] diff --git a/apps/product/models.py b/apps/product/models.py index 1241704..1ce656e 100644 --- a/apps/product/models.py +++ b/apps/product/models.py @@ -449,6 +449,13 @@ class QuotaIncentiveAssignment(BaseModel): ) heavy_value = models.PositiveBigIntegerField(default=0) light_value = models.PositiveBigIntegerField(default=0) + livestock_type = models.ForeignKey( + LiveStockType, + on_delete=models.CASCADE, + related_name='incentive_plans', + null=True + ) + quantity_kg = models.PositiveBigIntegerField(default=0) def __str__(self): return f"Quota ({self.quota.id}) for {self.incentive_plan.name}"