show bank accounts of stakeholders
This commit is contained in:
@@ -46,18 +46,10 @@ class BankAccountSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = BankAccountInformation
|
||||
fields = [
|
||||
'id',
|
||||
'user',
|
||||
'organization',
|
||||
'account_type',
|
||||
'account',
|
||||
'name',
|
||||
'card',
|
||||
'sheba'
|
||||
]
|
||||
fields = '__all__'
|
||||
extra_kwargs = {
|
||||
'user': {'required': False},
|
||||
'name': {'required': False},
|
||||
'organization': {'required': False},
|
||||
'account_type': {'required': False},
|
||||
'account': {'required': False},
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# Generated by Django 5.0 on 2025-08-17 06:19
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentication', '0033_organization_en_name_alter_organization_name'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='bankaccountinformation',
|
||||
name='account',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='bankaccountinformation',
|
||||
name='account_type',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='bankaccountinformation',
|
||||
name='card',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='bankaccountinformation',
|
||||
name='name',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='bankaccountinformation',
|
||||
name='sheba',
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,38 @@
|
||||
# Generated by Django 5.0 on 2025-08-17 06:23
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentication', '0034_remove_bankaccountinformation_account_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='bankaccountinformation',
|
||||
name='account',
|
||||
field=models.CharField(max_length=25, null=True, unique=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='bankaccountinformation',
|
||||
name='account_type',
|
||||
field=models.CharField(default='USR', max_length=10),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='bankaccountinformation',
|
||||
name='card',
|
||||
field=models.CharField(max_length=25, null=True, unique=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='bankaccountinformation',
|
||||
name='name',
|
||||
field=models.CharField(max_length=150, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='bankaccountinformation',
|
||||
name='sheba',
|
||||
field=models.CharField(max_length=30, null=True, unique=True),
|
||||
),
|
||||
]
|
||||
@@ -177,10 +177,10 @@ class BankAccountInformation(BaseModel):
|
||||
('USR', 'user'),
|
||||
)
|
||||
account_type = models.CharField(max_length=10, default='USR')
|
||||
name = models.CharField(max_length=150)
|
||||
card = models.CharField(max_length=25, unique=True)
|
||||
account = models.CharField(max_length=25, unique=True)
|
||||
sheba = models.CharField(max_length=30, unique=True)
|
||||
name = models.CharField(max_length=150, null=True)
|
||||
card = models.CharField(max_length=25, null=True, unique=True)
|
||||
account = models.CharField(max_length=25, null=True, unique=True)
|
||||
sheba = models.CharField(max_length=30, null=True, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.name}-{self.card}'
|
||||
|
||||
@@ -41,6 +41,7 @@ class Device(BaseModel):
|
||||
latitude = models.FloatField(default=0)
|
||||
longitude = models.FloatField(default=0)
|
||||
is_activated = models.BooleanField(default=False)
|
||||
# pre_registered = models.BooleanField(default=False)
|
||||
organization = models.ForeignKey(
|
||||
Organization,
|
||||
on_delete=models.CASCADE,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from apps.authentication.api.v1.serializers.serializer import BankAccountSerializer
|
||||
from apps.pos_device.web.api.v1.serilaizers import client as client_serializer
|
||||
from rest_framework.serializers import ModelSerializer
|
||||
from apps.pos_device import models as pos_models
|
||||
@@ -76,3 +77,12 @@ class StakeHoldersSerializer(ModelSerializer):
|
||||
class Meta:
|
||||
model = pos_models.StakeHolders
|
||||
fields = '__all__'
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
|
||||
representation['bank_account'] = BankAccountSerializer(
|
||||
instance.organization.bank_information.all()
|
||||
).data
|
||||
|
||||
return representation
|
||||
|
||||
Reference in New Issue
Block a user