if self.holiday_type_id.code == 'L009':
if self.employee_id.person_id.per_personal.marital_status.code == 'marital_status.unmarried':
self.employee_id.person_id.per_personal.update(
{'marital_status':39}
)
elif self.holiday_type_id.code in ['L011','L014']:
if self.employee_id.person_id.per_personal.children_situation.code == 'fertility_status.nullipara':
holidays = env['hr.holiday.leave'].search([('employee_id','=',self.employee_id.id),('state','=','done'),('holiday_type_id','in',[9,12])])
if len(holidays) == 0:
self.employee_id.person_id.per_personal.update(
{'children_situation':68}
)
elif len(holidays) >= 1:
self.employee_id.person_id.per_personal.update(
{'children_situation':69}
)
elif self.employee_id.person_id.per_personal.children_situation.code == 'fertility_status.one_child ':
holidays = env['hr.holiday.leave'].search([('employee_id','=',self.employee_id.id),('state','=','done'),('holiday_type_id','in',[9,12])])
if len(holidays) >= 1:
self.employee_id.person_id.per_personal.update(
{'children_situation':69}
)