feat: resignatioin提交时调用的方法
This commit is contained in:
parent
873e4bd80e
commit
f70605129c
|
|
@ -399,4 +399,24 @@ class ResignationViewSet(TicketMixin, EuModelViewSet):
|
||||||
queryset = Resignation.objects.all()
|
queryset = Resignation.objects.all()
|
||||||
serializer_class = ResignationSerializer
|
serializer_class = ResignationSerializer
|
||||||
search_fields = ["employee__name"]
|
search_fields = ["employee__name"]
|
||||||
workflow_key = "wf_resignation"
|
workflow_key = "wf_resignation"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def update_handle_date(ticket: Ticket, transition, new_ticket_data: dict):
|
||||||
|
handle_date = new_ticket_data.get("handle_date", None)
|
||||||
|
if handle_date:
|
||||||
|
resignation = Resignation.objects.get(ticket=ticket)
|
||||||
|
resignation.handle_date = handle_date
|
||||||
|
resignation.save()
|
||||||
|
else:
|
||||||
|
raise ParseError("请填写办理离职的交接日期")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def make_job_off(ticket: Ticket, transition, new_ticket_data: dict):
|
||||||
|
resignation = Resignation.objects.get(ticket=ticket)
|
||||||
|
emp = resignation.employee
|
||||||
|
emp.job_state = Employee.JOB_OFF
|
||||||
|
emp.save(update_fields=['job_state'])
|
||||||
|
user = emp.user
|
||||||
|
user.is_deleted = True
|
||||||
|
user.save(update_fields=['is_deleted'])
|
||||||
Loading…
Reference in New Issue