refector: visit audit end 修改司机入厂逻辑

This commit is contained in:
caoqianming 2023-05-24 17:35:51 +08:00
parent 9dff134329
commit 863a301cb8
1 changed files with 8 additions and 1 deletions

View File

@ -59,10 +59,17 @@ def visit_audit_end(ticket):
ep.name = visitor.name
ep.phone = visitor.phone
ep.photo = visitor.photo
ep.type = 'visitor'
eptype = 'visitor'
if visit.purpose == 50:
eptype = 'driver'
ep.type = eptype
ep.belong_dept = visit.receptionist.belong_dept if visit.receptionist else visit.belong_dept
ep.is_deleted = False
ep.save()
if ep.user:
user = ep.user
user.type = eptype
user.save()
visitor.employee = ep
visitor.visit = visit # 更新当前所属访客项目
visitor.save()