[FIX] survey: adapt form layout

Since the usage of the `CSS Grid` some view are broken.
The new form view system is less tolerant to missing colspan.
This commit, change the colspan when needed (e.g. no label) and in some
case extract the label outside the `DIV` to use `GRID` layout.

Steps to reproduce:
* Go to survey
* Select a survey
    * Select the Option notebook, fields are not aligned => BUG
* OR
    * Click on Add a question
    * list view in Answers notebook are not aligned => BUG

closes odoo/odoo#102319

X-original-commit: 51c1f6ed300e3dd185c45e14dff1ee9250f6e562
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Romeo Fragomeli (rfr) <rfr@odoo.com>
This commit is contained in:
Romeo Fragomeli
2022-10-06 13:05:54 +02:00
parent 9599e81cd2
commit e505ca48d2
2 changed files with 13 additions and 11 deletions
@@ -31,7 +31,7 @@
<field name="question_type" widget="radio" attrs="{'required': [('is_page', '=', False)]}" />
</group>
<group>
<div class="mx-lg-auto w-lg-50 d-none d-sm-block o_preview_questions">
<div class="mx-lg-auto w-lg-50 d-none d-sm-block o_preview_questions" colspan="2">
<!-- Multiple choice: only one answer -->
<div attrs="{'invisible': [('question_type', '!=', 'simple_choice')]}" role="img" aria-label="Multiple choice with one answer"
title="Multiple choice with one answer">
@@ -137,7 +137,7 @@
</group>
</group>
<group attrs="{'invisible': [('question_type', 'not in', ['simple_choice', 'multiple_choice', 'matrix'])]}">
<field name="suggested_answer_ids" context="{'default_question_id': active_id}" nolabel="1">
<field name="suggested_answer_ids" context="{'default_question_id': active_id}" nolabel="1" colspan="2">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="value" string="Choices"/>
@@ -154,7 +154,7 @@
<group attrs="{'invisible': [('question_type', '!=', 'matrix')]}">
<field name="matrix_row_ids" context="{'default_matrix_question_id': active_id}"
attrs="{'invisible': [('question_type', '!=', 'matrix')]}" nolabel="1">
attrs="{'invisible': [('question_type', '!=', 'matrix')]}" nolabel="1" colspan="2">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="value" string="Rows"/>
+10 -8
View File
@@ -98,9 +98,10 @@
<group string="Participants" name="participants">
<field name="access_mode"/>
<field name="users_login_required"/>
<div colspan="2" class="o_checkbox_optional_field"
<label for="is_attempts_limited" string="Limit Attempts"
attrs="{'invisible': ['|', ('has_conditional_questions', '=', True), '&amp;', ('access_mode', '=', 'public'), ('users_login_required', '=', False)]}"/>
<div class="o_checkbox_optional_field"
attrs="{'invisible': ['|', ('has_conditional_questions', '=', True), '&amp;', ('access_mode', '=', 'public'), ('users_login_required', '=', False)]}">
<label for="is_attempts_limited" string="Limit Attempts"/>
<field name="is_attempts_limited" nolabel="1"/>
<div attrs="{'invisible': [('is_attempts_limited', '=', False)]}">
to <field name="attempts_limit" nolabel="1" class="oe_inline"/> attempts
@@ -108,8 +109,8 @@
</div>
</group>
<group string="Time &amp; Scoring" name="scoring">
<div colspan="2" class="o_checkbox_optional_field">
<label for="is_time_limited" string="Survey Time Limit"/>
<label for="is_time_limited" string="Survey Time Limit"/>
<div class="o_checkbox_optional_field">
<field name="is_time_limited" nolabel="1"/>
<div attrs="{'invisible': [('is_time_limited', '=', False)]}">
<field name="time_limit" widget="float_time" nolabel="1" class="oe_inline"/> minutes
@@ -117,8 +118,8 @@
</div>
<field name="scoring_type" widget="radio" />
<field name="scoring_success_min" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}" />
<div colspan="2" class="o_checkbox_optional_field">
<label for="certification"/>
<label for="certification"/>
<div class="o_checkbox_optional_field">
<field name="certification" nolabel="1"/>
<div attrs="{'invisible': [('certification', '=', False)]}" class="w-100">
<field name="certification_report_layout" class="w-50"/>
@@ -128,9 +129,10 @@
</div>
</div>
<field name="certification_mail_template_id" attrs="{'invisible': [('certification', '=', False)]}"/>
<div colspan="2" class="float-start o_checkbox_optional_field"
<label for="certification_give_badge"
attrs="{'invisible': ['|', ('certification', '=', False), ('users_login_required', '=', False)]}"/>
<div class="float-start o_checkbox_optional_field"
attrs="{'invisible': ['|', ('certification', '=', False), ('users_login_required', '=', False)]}">
<label for="certification_give_badge"/>
<field name="certification_give_badge"/>
<div attrs="{'invisible': [('certification_give_badge', '=', False)]}">
<field name="certification_badge_id"