fix agencie share on pos device - fix validation bug of free product pos

This commit is contained in:
2025-10-05 17:01:21 +03:30
parent f36d767e1c
commit c3f745f5d0
11 changed files with 263 additions and 62 deletions

View File

@@ -449,6 +449,40 @@ class Quota(BaseModel):
return super(Quota, self).save(*args, **kwargs)
class QuotaFinalPriceTypes(BaseModel):
name = models.CharField(max_length=250)
en_name = models.CharField(max_length=250, null=True)
def __str__(self):
return f'{self.name}'
def save(self, *args, **kwargs):
return super(QuotaFinalPriceTypes, self).save(*args, **kwargs)
class QuotaPriceCalculationItems(BaseModel):
quota = models.ForeignKey(
Quota,
on_delete=models.CASCADE,
related_name='pricing_items',
null=True
)
pricing_type = models.ForeignKey(
'QuotaFinalPriceTypes',
on_delete=models.CASCADE,
related_name='pricing_items',
null=True
)
name = models.CharField(max_length=250)
value = models.PositiveBigIntegerField(default=0)
def __str__(self):
return f'{self.quota.quota_id}-{self.pricing_type.name}-{self.name}'
def save(self, *args, **kwargs):
return super(QuotaPriceCalculationItems, self).save(*args, **kwargs)
class QuotaStats(BaseModel):
quota = models.OneToOneField(
Quota,
@@ -501,10 +535,10 @@ class QuotaUsage(BaseModel):
('incentive', 'INCENTIVE'),
)
usage_type = models.CharField(max_length=150, choices=usage_type_choices, null=True)
def __str__(self):
return f'rancher: {self.rancher.ranching_farm} - plan: {self.incentive_plan.name}'
def save(self, *args, **kwargs):
return super(QuotaUsage, self).save(*args, **kwargs)