fix: rparty delete同步dept

This commit is contained in:
caoqianming 2023-04-03 14:01:38 +08:00
parent 7cbd581701
commit 4c4e637cc3
1 changed files with 7 additions and 0 deletions

View File

@ -37,6 +37,13 @@ class RpartyViewSet(CustomModelViewSet):
if user.is_authenticated and user.type == 'remployee':
queryset = queryset.filter(dept=user.belong_dept)
return queryset
def destroy(self, request, *args, **kwargs):
obj = self.get_object()
if obj.dept:
obj.dept.delete()
obj.delete()
return Response(status=204)
@action(methods=['post'], detail=True, perms_map={'post': 'rparty:assgin'}, serializer_class=RpartyAssignSerializer)
@transaction.atomic