stake holders sharing & quota distribution to CMP - list of stake holder sharings

This commit is contained in:
2025-09-07 13:51:39 +03:30
parent bcc79d2c30
commit 6bac1bbd45
13 changed files with 298 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
from apps.product.models import Product, Broker, QuotaBrokerValue
from apps.product.models import Product, Broker, QuotaBrokerValue, QuotaDistribution
from django.contrib.postgres.fields import ArrayField
from apps.authorization.models import UserRelations
from apps.authentication.models import Organization
@@ -271,14 +271,6 @@ class StakeHolders(BaseModel):
related_name='pos_stake_holders',
null=True
)
broker_amount = models.ForeignKey(
QuotaBrokerValue,
on_delete=models.CASCADE,
related_name='pos_stake_holders',
null=True
)
share_percent = models.FloatField(default=0)
default = models.BooleanField(default=False)
def __str__(self):
return f'Device: {self.assignment.device.serial}-organization: {self.organization.name}'
@@ -287,6 +279,31 @@ class StakeHolders(BaseModel):
return super(StakeHolders, self).save(*args, **kwargs)
class StakeHolderShareAmount(BaseModel):
quota_distribution = models.ForeignKey(
QuotaDistribution,
on_delete=models.CASCADE,
related_name='holders_share_amount',
null=True
)
stakeholders = models.ForeignKey(
StakeHolders,
on_delete=models.CASCADE,
related_name='holders_share_amount',
null=True
)
share_amount = models.PositiveBigIntegerField(default=0)
registering_organization = models.ForeignKey(
Organization,
on_delete=models.CASCADE,
related_name='holders_share_amount',
null=True
)
def save(self, *args, **kwargs):
return super(StakeHolderShareAmount, self).save(*args, **kwargs)
class POSFreeProducts(BaseModel):
product = models.ForeignKey(
Product,