Esempio n. 1
0
 def perform_bulk_accounts_change(self, serializer_cls, request):
     instance = self.get_object()
     serializer = serializer_cls(instance=instance,
                                 data=request.data,
                                 partial=True)
     serializer.is_valid(raise_exception=True)
     with disable_budget_tracking():
         data = serializer.save(updated_by=request.user)
     instance.mark_updated()
     return data
Esempio n. 2
0
 def bulk_create_fringes(self, request, *args, **kwargs):
     instance = self.get_object()
     serializer = BulkCreateFringesSerializer(instance=instance,
                                              data=request.data,
                                              partial=True)
     serializer.is_valid(raise_exception=True)
     with disable_budget_tracking():
         fringes = serializer.save(updated_by=request.user)
     instance.mark_updated()
     return response.Response(
         {'data': FringeSerializer(fringes, many=True).data},
         status=status.HTTP_201_CREATED)
Esempio n. 3
0
 def bulk_update_fringes(self, request, *args, **kwargs):
     instance = self.get_object()
     serializer = BulkUpdateFringesSerializer(
         instance=instance,
         data=request.data,
         partial=True,
         context=self.get_serializer_context())
     serializer.is_valid(raise_exception=True)
     with disable_budget_tracking():
         data = serializer.save(updated_by=request.user)
     instance.mark_updated()
     return response.Response(self.serializer_class(data).data,
                              status=status.HTTP_200_OK)