add pos sale type to quota
This commit is contained in:
18
apps/product/migrations/0077_quota_pos_sale_type.py
Normal file
18
apps/product/migrations/0077_quota_pos_sale_type.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.0 on 2025-09-24 08:53
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('product', '0076_incentiveplanrancher'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='quota',
|
||||||
|
name='pos_sale_type',
|
||||||
|
field=models.CharField(choices=[('weight', 'WEIGHT'), ('count', 'COUNT'), ('all', 'ALL')], default='all', max_length=25),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -394,6 +394,12 @@ class Quota(BaseModel):
|
|||||||
limit_by_herd_size = models.BooleanField(default=True)
|
limit_by_herd_size = models.BooleanField(default=True)
|
||||||
is_closed = models.BooleanField(default=False)
|
is_closed = models.BooleanField(default=False)
|
||||||
closed_at = models.DateTimeField(null=True, blank=True)
|
closed_at = models.DateTimeField(null=True, blank=True)
|
||||||
|
pos_sale_type_choices = (
|
||||||
|
('weight', 'WEIGHT'),
|
||||||
|
('count', 'COUNT'),
|
||||||
|
('all', 'ALL'),
|
||||||
|
)
|
||||||
|
pos_sale_type = models.CharField(choices=pos_sale_type_choices, max_length=25, default='all')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"Quota ({self.id}) for {self.product.name}"
|
return f"Quota ({self.id}) for {self.product.name}"
|
||||||
|
|||||||
@@ -89,12 +89,13 @@ class QuotaDistributionSerializer(serializers.ModelSerializer):
|
|||||||
representation['quota'] = {
|
representation['quota'] = {
|
||||||
'quota_identity': instance.quota.quota_id,
|
'quota_identity': instance.quota.quota_id,
|
||||||
'quota_weight': instance.quota.quota_weight,
|
'quota_weight': instance.quota.quota_weight,
|
||||||
|
'pos_sale_type': instance.quota.pos_sale_type,
|
||||||
'quota_livestock_allocations': quota_live_stock_allocation_info(
|
'quota_livestock_allocations': quota_live_stock_allocation_info(
|
||||||
instance.quota
|
instance.quota
|
||||||
),
|
),
|
||||||
'quota_incentive_plans': quota_incentive_plans_info(instance.quota, rancher),
|
'quota_incentive_plans': quota_incentive_plans_info(instance.quota, rancher),
|
||||||
'quota_sale_license': instance.quota.sale_license,
|
'quota_sale_license': instance.quota.sale_license,
|
||||||
'has_sale_license': instance.quota.is_in_valid_time()
|
'has_sale_license': instance.quota.is_in_valid_time(),
|
||||||
}
|
}
|
||||||
|
|
||||||
sale_limitation = SystemConfig.get(
|
sale_limitation = SystemConfig.get(
|
||||||
|
|||||||
Reference in New Issue
Block a user