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

Merged
elabore_bot merged 1 commits from 16.0-fix into 16.0 2025-09-22 12:39:07 +00:00
2 changed files with 5 additions and 2 deletions
Showing only changes of commit b919c0de28 - Show all commits

View File

@@ -11,7 +11,7 @@ Allow to create record of any model when sending the form :
* Associate question with fields
* For x2m fields : Associate values to questions
""",
"version": "16.0.1.0.1",
"version": "16.0.1.0.2",
"license": "AGPL-3",
"author": "Elabore",
"website": "https://www.elabore.coop",

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':