Purpose: Allow users to make sure they will get an answer to the questions they ask attendees while they register. e.g.: - You organize activities for kids and want to make sure you have a second phone number available in case of emergencies - You organize B2B events and need to know in which industry your attendees work - You use the Event/CRM bridge and plan to filter attendees based on those answers ... Specifications: In the question form view, a boolean "Mandatory Answer" has been added. In the list view, that field has been added as column. In the registration form: - "*", next to each mandatory question has been added - "*" has been added next to name and email which were already mandatory - the mandatory question have been actually made mandatory by preventing user to submit empty answer Remark: once_per_order was missing in the list view of the event template questions. We have added it as well as "mandatory answer" field. The question list view of the template and the event are now almost identical (the button to the stat is obviously not present in the template). Technical remarks: - To ensures that multiple choice answer are filled by the users, we have added an empty choice selected by default which forces the user to choose one option. - Empty answer were already filtered by the server and not inserted in the database (in controller method _process_attendees_form, value evaluated to false are not inserted) Task-2745835 closes odoo/odoo#83586 Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
79 lines
4.5 KiB
XML
79 lines
4.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<record id="event_type_view_form_inherit_question" model="ir.ui.view">
|
|
<field name="name">event.type.view.form.inherit.question</field>
|
|
<field name="model">event.type</field>
|
|
<field name="inherit_id" ref="website_event.event_type_view_form"/>
|
|
<field name="arch" type="xml">
|
|
<page name="event_type_communication" position="after">
|
|
<page string="Questions">
|
|
<field name="question_ids" class="w-100">
|
|
<tree sample="1">
|
|
<field name="title"/>
|
|
<field name="is_mandatory_answer"/>
|
|
<field name="once_per_order"/>
|
|
<field name="question_type" />
|
|
<field name="answer_ids" widget = "many2many_tags"/>
|
|
</tree>
|
|
</field>
|
|
</page>
|
|
</page>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="event_event_view_form" model="ir.ui.view">
|
|
<field name="name">event.event.view.form.inherit.question</field>
|
|
<field name="model">event.event</field>
|
|
<field name="inherit_id" ref="website_event.event_event_view_form"/>
|
|
<field name="arch" type="xml">
|
|
<data>
|
|
<page name="event_notes" position="before">
|
|
<page string="Questions" name="questions">
|
|
<field name="question_ids" string="Question" nolabel="1">
|
|
<tree>
|
|
<field name="sequence" widget="handle" />
|
|
<field name="title"/>
|
|
<field name="is_mandatory_answer"/>
|
|
<field name="once_per_order"/>
|
|
<field name="question_type" string="Type" />
|
|
<field name="answer_ids" widget="many2many_tags"
|
|
attrs="{'invisible': [('question_type', '!=', 'simple_choice')]}" />
|
|
<button name="action_view_question_answers" type="object" class="fa fa-bar-chart p-0" title="Answer Breakdown" />
|
|
</tree>
|
|
<!-- Need to repeat the whole tree form here to be able to create answers properly
|
|
Without this, the sub-fields of answer_ids are unknown to the web framework.
|
|
We need this because we create questions and answers when the event type changes. -->
|
|
<form string="Question">
|
|
<sheet>
|
|
<h1><field name="title" placeholder='e.g. "Do you have any diet restrictions?"' /></h1>
|
|
<group>
|
|
<group>
|
|
<field name="is_mandatory_answer"/>
|
|
<field name="question_type" widget="radio" options="{'horizontal': true}"/>
|
|
</group>
|
|
<group>
|
|
<field name="once_per_order"/>
|
|
</group>
|
|
</group>
|
|
<notebook attrs="{'invisible': [('question_type', '!=', 'simple_choice')]}">
|
|
<page string="Answers" name="answers">
|
|
<field name="answer_ids">
|
|
<tree editable="bottom">
|
|
<!-- 'display_name' is necessary for the many2many_tags to work on the event view -->
|
|
<field name="display_name" invisible="1" />
|
|
<field name="sequence" widget="handle" />
|
|
<field name="name"/>
|
|
</tree>
|
|
</field>
|
|
</page>
|
|
</notebook>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</page>
|
|
</page>
|
|
</data>
|
|
</field>
|
|
</record>
|
|
</odoo>
|