import - BankAccountDeviceLink for set device to a bank_account/changes in stakeholders & pos

This commit is contained in:
2025-12-30 16:57:15 +03:30
parent 9a02ad4622
commit e3318b7e1e
8 changed files with 104 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ import string
from django.contrib.postgres.fields import ArrayField
from django.db import models
from apps.authentication.models import Organization, City, Province
from apps.authentication.models import Organization, City, Province, BankAccountInformation
from apps.authorization.models import UserRelations
from apps.core.models import BaseModel
from apps.product.models import Product, Broker, QuotaBrokerValue, QuotaDistribution, OrganizationQuotaStats
@@ -70,6 +70,34 @@ class Device(BaseModel):
return super(Device, self).save(*args, **kwargs)
class BankAccountDeviceLink(BaseModel):
organization = models.ForeignKey(
Organization,
on_delete=models.CASCADE,
related_name='bank_account_device_links',
null=True
)
bank_account = models.ForeignKey(
BankAccountInformation,
on_delete=models.CASCADE,
related_name='linked_devices',
null=True
)
device = models.ForeignKey(
Device,
on_delete=models.CASCADE,
related_name='linked_bank_accounts',
null=True
)
def __str__(self):
return (f'{self.id} --> organization: {self.organization.name}/'
f'{self.organization.id} --> device: {self.device.serial}')
def save(self, *args, **kwargs):
return super(BankAccountDeviceLink, self).save(*args, **kwargs)
class DeviceActivationCode(BaseModel):
device = models.ForeignKey(
Device,