summaryrefslogtreecommitdiff
path: root/addons/website_event_questions/views/event_views.xml
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/website_event_questions/views/event_views.xml
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/website_event_questions/views/event_views.xml')
-rw-r--r--addons/website_event_questions/views/event_views.xml84
1 files changed, 84 insertions, 0 deletions
diff --git a/addons/website_event_questions/views/event_views.xml b/addons/website_event_questions/views/event_views.xml
new file mode 100644
index 00000000..7b92e292
--- /dev/null
+++ b/addons/website_event_questions/views/event_views.xml
@@ -0,0 +1,84 @@
+<?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">
+ <div name="event_type_attendees_auto_confirm" position="after">
+ <div class="col-12 col-lg-12 o_setting_box">
+ <div class="o_setting_left_pane">
+ <field name="use_questions"/>
+ </div>
+ <div class="o_setting_right_pane">
+ <label for="use_questions"/>
+ <div class="row mt16" attrs="{'invisible': [('use_questions', '=', False)]}">
+ <div class="col-lg-9">
+ <field name="question_ids">
+ <tree>
+ <field name="title"/>
+ <field name="question_type" />
+ </tree>
+ </field>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </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" nolabel="1">
+ <tree>
+ <field name="sequence" widget="handle" />
+ <field name="title"/>
+ <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" /></h1>
+ <group class="mb-0">
+ <group class="mb-0">
+ <div colspan="2">
+ <field name="once_per_order"/>
+ <label for="once_per_order"/>
+ </div>
+ <field name="question_type" widget="radio" options="{'horizontal': true}" />
+ </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>