diff --git a/apps/product/migrations/0077_quota_pos_sale_type.py b/apps/product/migrations/0077_quota_pos_sale_type.py new file mode 100644 index 0000000..fafe1af --- /dev/null +++ b/apps/product/migrations/0077_quota_pos_sale_type.py @@ -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), + ), + ] diff --git a/apps/product/models.py b/apps/product/models.py index e080e6a..be67750 100644 --- a/apps/product/models.py +++ b/apps/product/models.py @@ -394,6 +394,12 @@ class Quota(BaseModel): limit_by_herd_size = models.BooleanField(default=True) is_closed = models.BooleanField(default=False) 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): return f"Quota ({self.id}) for {self.product.name}" diff --git a/apps/product/pos/api/v1/serializers/quota_distribution_serializers.py b/apps/product/pos/api/v1/serializers/quota_distribution_serializers.py index d8a3ce0..e07aea6 100644 --- a/apps/product/pos/api/v1/serializers/quota_distribution_serializers.py +++ b/apps/product/pos/api/v1/serializers/quota_distribution_serializers.py @@ -89,12 +89,13 @@ class QuotaDistributionSerializer(serializers.ModelSerializer): representation['quota'] = { 'quota_identity': instance.quota.quota_id, 'quota_weight': instance.quota.quota_weight, + 'pos_sale_type': instance.quota.pos_sale_type, 'quota_livestock_allocations': quota_live_stock_allocation_info( instance.quota ), 'quota_incentive_plans': quota_incentive_plans_info(instance.quota, rancher), '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(