feat: resignation添加ticketMixin
This commit is contained in:
parent
146756d1b8
commit
dc17c01aaf
|
|
@ -29,6 +29,7 @@ from apps.utils.export import export_excel
|
|||
from apps.utils.viewsets import CustomGenericViewSet, CustomModelViewSet, EuModelViewSet
|
||||
from apps.utils.mixins import BulkCreateModelMixin, BulkDestroyModelMixin, CustomListModelMixin, RetrieveModelMixin
|
||||
from apps.wf.models import Ticket
|
||||
from apps.wf.mixins import TicketMixin
|
||||
epTypeOptions = {'employee': '正式员工', 'remployee': '相关方',
|
||||
'visitor': '访客', 'driver': '货车司机'}
|
||||
epStateOptions = {10: '在职', 20: '离职', 30: '退休'}
|
||||
|
|
@ -393,16 +394,9 @@ class CertificateViewSet(CustomModelViewSet):
|
|||
ins.get_state(need_update=True)
|
||||
|
||||
|
||||
class ResignationViewSet(EuModelViewSet):
|
||||
class ResignationViewSet(TicketMixin, EuModelViewSet):
|
||||
select_related_fields = ['employee', 'employee__belong_dept', 'employee__post']
|
||||
queryset = Resignation.objects.all()
|
||||
serializer_class = ResignationSerializer
|
||||
search_fields = ["employee__name"]
|
||||
|
||||
def perform_destroy(self, instance):
|
||||
ticket:Ticket = instance.ticket
|
||||
if ticket and ticket.state.type != 1:
|
||||
raise ParseError('该离职记录关联的工单已被处理,不可删除')
|
||||
instance.delete()
|
||||
if ticket:
|
||||
ticket.delete()
|
||||
workflow_key = ["wf_resignation"]
|
||||
Loading…
Reference in New Issue