values = kwargs.setdefault('values', {})
legalentity = values.get('x_legalentity')
is_show_of_report = values.get('is_show_of_report')
reason_leave_type = values.get('reason_leave_type')
reason_leave = values.get('reason_leave')
if isinstance(legalentity, int):
legalentity = env['legal.enity'].search([('id', '=', legalentity)])
if isinstance(reason_leave_type, int):
reason_leave_type = env['reason.leave.type'].search([('id', '=', reason_leave_type)])
if isinstance(reason_leave, int):
reason_leave = env['reason.leave'].search([('id', '=', reason_leave)])
if legalentity.code in ['L004', 'L003', 'L002', 'L005', 'LE004']:
if is_show_of_report == '0':
if reason_leave_type.code == 'C003' and reason_leave.code == 'L001':
result.update({'x_b005': '合同期满'})
elif reason_leave_type.code == 'C001' and reason_leave.code in ['L002', 'L004', 'L005', 'L006']:
result.update({'x_b005': '单位解除合同'})
elif reason_leave_type.code == 'C001' and reason_leave.code in ['L003']:
result.update({'x_b005': '双方协商一致解除'})
elif (reason_leave_type.code == 'C004' and reason_leave.code in ['L007']) or (reason_leave_type.code == 'C002' and reason_leave.code in ['L008','L009','L010','L011','L012','L013','L014','L015','L016','L017','L018']):
result.update({'x_b005': '个人解除合同'})
elif reason_leave_type.code == 'C005' and reason_leave.code in ['L019']:
result.update({'x_b005': '到达法定退休年龄'})
elif reason_leave_type.code == 'C006' and reason_leave.code in ['L020']:
result.update({'x_b005': '企业裁员'})
elif reason_leave_type.code == 'C007' and reason_leave.code in ['L021']:
result.update({'x_b005': '死亡或失踪'})
else:
result.update({'x_b005': False})
else:
result.update({'x_b005': False})
else:
result.update({'x_b005': False})