fix permissions serializer on role
This commit is contained in:
@@ -106,6 +106,7 @@ class RoleSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
representation = super().to_representation(instance)
|
||||
representation['type'] = auth_serializer.OrganizationTypeSerializer(instance.type).data
|
||||
representation['permissions'] = PermissionSerializer(instance.permissions, many=True)
|
||||
if instance.parent_role:
|
||||
representation['parent_role'] = {'name': instance.parent_role.role_name, 'id': instance.parent_role.id}
|
||||
return representation
|
||||
|
||||
@@ -36,6 +36,7 @@ def quota_live_stock_allocation_info(quota: Quota) -> typing.Any:
|
||||
} for alloc in allocations]
|
||||
|
||||
return allocations_list
|
||||
return None
|
||||
|
||||
|
||||
def quota_incentive_plans_info(quota: Quota, rancher: Rancher) -> typing.Any:
|
||||
@@ -63,6 +64,7 @@ def quota_incentive_plans_info(quota: Quota, rancher: Rancher) -> typing.Any:
|
||||
incentive_plans_list.append(incentive_plans_data)
|
||||
|
||||
return incentive_plans_list
|
||||
return None
|
||||
|
||||
|
||||
def quota_brokers_value(quota: Quota) -> typing.Any:
|
||||
@@ -77,6 +79,7 @@ def quota_brokers_value(quota: Quota) -> typing.Any:
|
||||
} for broker in brokers]
|
||||
|
||||
return broker_values_list
|
||||
return None
|
||||
|
||||
|
||||
def quota_attribute_value(quota: Quota) -> typing.Any:
|
||||
@@ -91,6 +94,7 @@ def quota_attribute_value(quota: Quota) -> typing.Any:
|
||||
} for attr in attributes]
|
||||
|
||||
return attribute_values_list
|
||||
return None
|
||||
|
||||
|
||||
def quota_pricing_items_by_type(quota: Quota, sharing: list) -> typing.Any:
|
||||
|
||||
@@ -131,6 +131,7 @@ class InventoryEntryViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet,
|
||||
class InventoryQuotaSaleTransactionViewSet(SoftDeleteMixin, DynamicSearchMixin, BaseViewSet, viewsets.ModelViewSet):
|
||||
queryset = warehouse_models.InventoryQuotaSaleTransaction.objects.all()
|
||||
serializer_class = warehouse_serializers.InventoryQuotaSaleTransactionSerializer
|
||||
filter_backends = [filters.SearchFilter]
|
||||
search_fields = [
|
||||
'rancher_fullname', 'rancher_mobile', 'pos_device__device_identity',
|
||||
'pos_device__acceptor', 'pos_device__terminal', 'pos_device__serial',
|
||||
|
||||
Reference in New Issue
Block a user