Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Surveys

Entity: survey.question.answer

Compute Method: _compute_value_label

View 19.0
Inputs Method Outputs
  • value
  • question_id
  • id
  • question_id.suggested_answer_ids
  • question_id.suggested_answer_ids.ids
+ """ Compute the label as the value if not empty or a letter representing the index of the answer otherwise. """
+ for answer in self:
+             # using image -> use a letter to represent the value
+             if not answer.value and answer.question_id and answer.id:
+                 answer_idx = answer.question_id.suggested_answer_ids.ids.index(answer.id)
+                 answer.value_label = chr(65 + answer_idx) if answer_idx < 27 else ''
+             else:
+                 answer.value_label = answer.value or ''
  • value_label

Back to entity