hrm signal bug
This commit is contained in:
parent
c478425b12
commit
0f3ca55ac3
|
@ -1,28 +1,4 @@
|
|||
from django.db.models.signals import post_save
|
||||
from apps.system.models import User
|
||||
from django.dispatch import receiver
|
||||
from apps.hrm.models import Employee
|
||||
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
def updateEmployee(sender, instance, created, **kwargs):
|
||||
ep = None
|
||||
ep_created = False
|
||||
if created:
|
||||
ep, ep_created = Employee.objects.get_or_create(user=instance,
|
||||
defaults={
|
||||
"user": instance,
|
||||
"name": instance.name,
|
||||
"phone": instance.phone,
|
||||
"belong_dept": instance.belong_dept,
|
||||
"post": instance.post,
|
||||
"type": instance.type
|
||||
})
|
||||
if ep and not ep_created:
|
||||
ep.belong_dept = instance.belong_dept
|
||||
ep.post = instance.post
|
||||
ep.type = instance.type
|
||||
if instance.phone != ep.phone:
|
||||
ep.phone = instance.phone
|
||||
ep.save()
|
||||
ep.save()
|
||||
from apps.hrm.models import Employee
|
|
@ -28,10 +28,9 @@ def sync_to_rep(ep: Employee):
|
|||
|
||||
def bind_rpj(ticket: Ticket, transition: Transition, new_ticket_data: dict):
|
||||
rpj = Rpj.objects.get(id=new_ticket_data['rpj'])
|
||||
# ticket_data = ticket.ticket_data
|
||||
# ticket_data.update({'level': opl.level})
|
||||
# ticket.ticket_data = ticket_data
|
||||
# ticket.save()
|
||||
ticket_data = ticket.ticket_data
|
||||
ticket_data.update({'belong_dept': rpj.belong_dept})
|
||||
ticket.ticket_data = ticket_data
|
||||
rpj.ticket = ticket
|
||||
rpj.state = Rpj.RPJ_AUDIT
|
||||
rpj.save()
|
||||
|
|
|
@ -187,14 +187,14 @@ class XxCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
|||
pass
|
||||
|
||||
@action(methods=['post'], detail=False,
|
||||
authentication_classes=[], permission_classes=[],
|
||||
authentication_classes=[], permission_classes=[], throttle_classes=[],
|
||||
serializer_class=serializers.Serializer, logging_methods=[]) # 日志
|
||||
def c_location(self, request, pk=None):
|
||||
loc_change(data=request.data['data'])
|
||||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=False,
|
||||
authentication_classes=[], permission_classes=[],
|
||||
authentication_classes=[], permission_classes=[], throttle_classes=[],
|
||||
serializer_class=serializers.Serializer, logging_methods=['POST']) # 日志
|
||||
def c_rail(self, request, pk=None):
|
||||
data = request.data
|
||||
|
@ -207,7 +207,7 @@ class XxCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
|||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=False,
|
||||
authentication_classes=[], permission_classes=[],
|
||||
authentication_classes=[], permission_classes=[], throttle_classes=[],
|
||||
serializer_class=serializers.Serializer, logging_methods=['POST']) # 日志
|
||||
def c_one_key_alarm(self, request, pk=None):
|
||||
data = request.data
|
||||
|
@ -216,7 +216,7 @@ class XxCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
|||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=False,
|
||||
authentication_classes=[], permission_classes=[],
|
||||
authentication_classes=[], permission_classes=[], throttle_classes=[],
|
||||
serializer_class=serializers.Serializer, logging_methods=['POST']) # 日志
|
||||
def c_lowpower(self, request, pk=None):
|
||||
data = request.data
|
||||
|
@ -362,7 +362,7 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
|||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=False,
|
||||
authentication_classes=[], permission_classes=[],
|
||||
authentication_classes=[], permission_classes=[], throttle_classes=[],
|
||||
serializer_class=serializers.Serializer, logging_methods=['POST']) # 日志
|
||||
def c_swip(self, request, pk=None):
|
||||
"""门禁事件
|
||||
|
@ -377,7 +377,7 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
|||
return Response()
|
||||
|
||||
@action(methods=['post'], detail=False,
|
||||
authentication_classes=[], permission_classes=[],
|
||||
authentication_classes=[], permission_classes=[], throttle_classes=[],
|
||||
serializer_class=serializers.Serializer, logging_methods=['POST']) # 日志
|
||||
def c_monitor(self, request, pk=None):
|
||||
"""监控事件
|
||||
|
|
Loading…
Reference in New Issue