stake holders sharing & quota distribution to CMP - list of stake holder sharings
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from apps.product.web.api.v1.serializers.quota_distribution_serializers import QuotaDistributionSerializer
|
||||
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
|
||||
@@ -85,4 +86,28 @@ class StakeHoldersSerializer(ModelSerializer):
|
||||
instance.organization.bank_information.all().first()
|
||||
).data
|
||||
|
||||
representation['organization'] = {
|
||||
'name': instance.organization.name,
|
||||
'id': instance.organization.id
|
||||
}
|
||||
|
||||
return representation
|
||||
|
||||
|
||||
class StakeHolderShareAmountSerializer(ModelSerializer):
|
||||
class Meta:
|
||||
model = pos_models.StakeHolderShareAmount
|
||||
fields = '__all__'
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
|
||||
# distribution information
|
||||
representation['quota_distribution'] = QuotaDistributionSerializer(
|
||||
instance.quota_distribution
|
||||
).data
|
||||
|
||||
# stakeholders information
|
||||
representation['stakeholders'] = StakeHoldersSerializer(instance.stakeholders).data
|
||||
|
||||
return representation
|
||||
|
||||
Reference in New Issue
Block a user