[FIX]survey_record_generation:fix IndexError when record value is empty

This commit is contained in:
2025-09-22 14:26:56 +02:00
parent 0c26ef9313
commit b919c0de28
2 changed files with 5 additions and 2 deletions

View File

@@ -59,7 +59,10 @@ class SurveyUserInput(models.Model):
if user_input_line.suggested_answer_id and user_input_line.suggested_answer_id.record_id:
record_ids.append(user_input_line.suggested_answer_id.record_id.id)
if field_value.question_id.question_type == 'simple_choice':
vals[field_value.field_id.name] = record_ids[0]
if record_ids:
vals[field_value.field_id.name] = record_ids[0]
else:
vals[field_value.field_id.name] = None
else:
vals[field_value.field_id.name] = record_ids
if field_value.question_id.answer_values_type == 'value':