Display "Multiple choice: only one answer" (simple_choice) survey questions as a dropdown list instead of radio buttons, per question. The native radios are kept (hidden by CSS) and still carry the answer: the dropdown only clicks them, so validation, conditional questions, "Other" comment, auto-submit and AJAX submit are handled natively. In review / print mode, only the selected and correct answers are displayed. Native rendering is kept when suggested answers contain images. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
12 lines
354 B
Python
12 lines
354 B
Python
from odoo import fields, models
|
|
|
|
|
|
class SurveyQuestion(models.Model):
|
|
_inherit = 'survey.question'
|
|
|
|
display_dropdown = fields.Boolean(
|
|
string="Display as dropdown list",
|
|
help="Display this single choice question as a dropdown list instead "
|
|
"of radio buttons. Ignored if the suggested answers contain images.",
|
|
)
|