list of organizations by province - some changes in quota an models of that

This commit is contained in:
2025-06-10 14:53:01 +03:30
parent 2482b9bc45
commit b52baa5d3b
5 changed files with 88 additions and 6 deletions

View File

@@ -192,6 +192,8 @@ class SaleUnit(BaseModel):
class IncentivePlan(BaseModel):
""" incentive plan for every quota """
PLAN_TYPE_CHOICES = (
('ILQ', 'increasing livestock quotas'),
('SM', 'statistical/monitoring')
@@ -226,6 +228,8 @@ class IncentivePlan(BaseModel):
class Quota(BaseModel):
""" quota for product with some conditions """
quota_id = models.CharField(max_length=15, null=True)
quota_code = models.CharField(max_length=15, null=True)
product = models.ForeignKey(
@@ -240,7 +244,7 @@ class Quota(BaseModel):
choices=[("rural", "روستایی"), ("industrial", "صنعتی"), ("nomadic", "عشایری")] # noqa
)
has_distribution_limit = models.BooleanField(default=False)
distribution_mode = models.CharField(max_length=50, blank=True, null=True)
distribution_mode = ArrayField(base_field=models.IntegerField(), blank=True, null=True)
base_price_factory = models.DecimalField(max_digits=12, decimal_places=2)
base_price_cooperative = models.DecimalField(max_digits=12, decimal_places=2)
@@ -254,6 +258,8 @@ class Quota(BaseModel):
class QuotaIncentiveAssignment(BaseModel):
""" assign incentive plan to quota """
quota = models.ForeignKey(
Quota,
on_delete=models.CASCADE,
@@ -263,7 +269,8 @@ class QuotaIncentiveAssignment(BaseModel):
incentive_plan = models.ForeignKey(
IncentivePlan,
on_delete=models.CASCADE,
related_name='quota_assignment'
related_name='quota_assignment',
null=True
)
heavy_value = models.DecimalField(max_digits=12, decimal_places=2)
light_value = models.DecimalField(max_digits=12, decimal_places=2)
@@ -276,6 +283,8 @@ class QuotaIncentiveAssignment(BaseModel):
class QuotaBrokerValue(BaseModel):
""" broker attributes value for quota """
quota = models.ForeignKey(
Quota,
on_delete=models.CASCADE,
@@ -297,6 +306,8 @@ class QuotaBrokerValue(BaseModel):
class QuotaLivestockAllocation(BaseModel):
""" livestock allocation to quota """
quota = models.ForeignKey(
"Quota",
on_delete=models.CASCADE,