[IMP] survey_event_registration_generation: manage multiple training products fields in survey
This commit is contained in:
@@ -7,17 +7,21 @@
|
||||
<field name="inherit_id" ref="survey.survey_question_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='comments_allowed']/.." position="after">
|
||||
<group name="event_registration" string="Event registration">
|
||||
<!-- related event product question, to filter events, in case of event question -->
|
||||
<field name="event_product_question_id" options="{'no_open': True, 'no_create': True}"
|
||||
attrs="{'invisible': [('question_type','!=','event')]}"
|
||||
help="Select the question asking for event product, to filter proposed events." />
|
||||
|
||||
<group name="event_registration" string="Event registration">
|
||||
<!-- event registration field, filtered by event_registration_allowed_field_ids (invisible) -->
|
||||
<field name="event_registration_field" widget="selection" />
|
||||
<field name="event_registration_allowed_field_ids" invisible="1" />
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='validation_required']" position="before">
|
||||
<field name="show_events_and_event_products_only_visible_in_survey"
|
||||
attrs="{'invisible': [('question_type', 'not in', ['event_product', 'event', 'multiple_event_products'])]}"
|
||||
/>
|
||||
<!-- related event product question, to filter events, in case of event question -->
|
||||
<field name="event_product_question_id" options="{'no_open': True, 'no_create': True}"
|
||||
attrs="{'invisible': [('question_type','!=','event')],'required': [('question_type','=','event')]}"
|
||||
help="Select the question asking for event product, to filter proposed events." />
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
@@ -23,10 +23,12 @@
|
||||
t-att-data-question-type="question.question_type">
|
||||
<option>Please select...</option>
|
||||
<t t-foreach="event_products" t-as="event_product">
|
||||
<option
|
||||
t-att-value="event_product.id"
|
||||
t-att-selected="answer_lines and (answer_lines[0].value_event_product.id == event_product.id)">
|
||||
<t t-esc="event_product.name"/></option>
|
||||
<t t-if="not question.show_events_and_event_products_only_visible_in_survey or (question.show_events_and_event_products_only_visible_in_survey and event_product.visible_in_survey)">
|
||||
<option
|
||||
t-att-value="event_product.id"
|
||||
t-att-selected="answer_lines and (answer_lines[0].value_event_product.id == event_product.id)">
|
||||
<t t-esc="event_product.name"/></option>
|
||||
</t>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
@@ -41,16 +43,18 @@
|
||||
<div class="d-flex flex-wrap col-lg-12">
|
||||
<t t-set="has_correct_answer" t-value="scoring_display_correction and any(label.is_correct for label in question.suggested_answer_ids)"/>
|
||||
<t t-foreach="event_products" t-as="event_product">
|
||||
<label t-att-class="'o_survey_choice_btn form-label me-2 py-1 px-3 rounded %s' % ('o_survey_selected' if answer_line else '')">
|
||||
|
||||
<input type="checkbox" t-att-value='event_product.id' class="o_survey_form_choice_item invisible position-absolute"
|
||||
t-att-name="question.id" />
|
||||
<span class="ms-2 text-break" t-field='event_product.name'/>
|
||||
|
||||
<i class="fa fa-check-circle float-end mt-1 position-relative"></i>
|
||||
<i class="fa fa-circle-thin float-end mt-1 position-relative"></i>
|
||||
|
||||
</label>
|
||||
<t t-if="not question.show_events_and_event_products_only_visible_in_survey or (question.show_events_and_event_products_only_visible_in_survey and event_product.visible_in_survey)">
|
||||
<label t-att-class="'o_survey_choice_btn form-label me-2 py-1 px-3 rounded %s' % ('o_survey_selected' if answer_line else '')">
|
||||
|
||||
<input type="checkbox" t-att-value='event_product.id' class="o_survey_form_choice_item invisible position-absolute"
|
||||
t-att-name="question.id" t-att-data-question-type="question.question_type" />
|
||||
<span class="ms-2 text-break" t-field='event_product.name'/>
|
||||
|
||||
<i class="fa fa-check-circle float-end mt-1 position-relative"></i>
|
||||
<i class="fa fa-circle-thin float-end mt-1 position-relative"></i>
|
||||
|
||||
</label>
|
||||
</t>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,14 +67,19 @@
|
||||
<div class="o_survey_comment_container p-0">
|
||||
<select class="o_survey_form_choice_item"
|
||||
t-att-name="question.id"
|
||||
t-att-data-event-product-question-id="question.event_product_question_id.id"
|
||||
t-att-data-event-product-question-type="question.event_product_question_id.question_type"
|
||||
t-att-placeholder="question.question_placeholder"
|
||||
t-att-data-question-type="question.question_type">
|
||||
t-att-data-question-type="question.question_type"
|
||||
t-att-data-only-visible-in-survey="question.show_events_and_event_products_only_visible_in_survey">
|
||||
<option>Please select...</option>
|
||||
<t t-foreach="events" t-as="event">
|
||||
<option
|
||||
t-att-value="event.id"
|
||||
t-att-selected="answer_lines and (answer_lines[0].value_event.id == event.id)">
|
||||
<t t-esc="event.name"/></option>
|
||||
<t t-if="not question.show_events_and_event_products_only_visible_in_survey or (question.show_events_and_event_products_only_visible_in_survey and event.visible_in_survey)">
|
||||
<option
|
||||
t-att-value="event.id"
|
||||
t-att-selected="answer_lines and (answer_lines[0].value_event.id == event.id)">
|
||||
<t t-esc="event.name"/></option>
|
||||
</t>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user