diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/website_event_questions/views | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/website_event_questions/views')
6 files changed, 258 insertions, 0 deletions
diff --git a/addons/website_event_questions/views/assets.xml b/addons/website_event_questions/views/assets.xml new file mode 100644 index 00000000..d85a4bda --- /dev/null +++ b/addons/website_event_questions/views/assets.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> +<data> + <template id="assets_tests" name="Website Event Questions Assets Tests" inherit_id="web.assets_tests"> + <xpath expr="." position="inside"> + <script type="text/javascript" src="/website_event_questions/static/tests/tours/tickets_questions.js"></script> + </xpath> + </template> +</data> +</odoo> diff --git a/addons/website_event_questions/views/event_question_views.xml b/addons/website_event_questions/views/event_question_views.xml new file mode 100644 index 00000000..3fec664e --- /dev/null +++ b/addons/website_event_questions/views/event_question_views.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <record id="event_question_view_form" model="ir.ui.view">
+ <field name="name">event.question.view.form</field>
+ <field name="model">event.question</field>
+ <field name="arch" type="xml">
+ <form string="Question">
+ <sheet>
+ <h1><field name="title" /></h1>
+ <group>
+ <group>
+ <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>
+ </record>
+</odoo>
diff --git a/addons/website_event_questions/views/event_registration_answer_views.xml b/addons/website_event_questions/views/event_registration_answer_views.xml new file mode 100644 index 00000000..d5cd93c2 --- /dev/null +++ b/addons/website_event_questions/views/event_registration_answer_views.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <record id="event_registration_answer_view_search" model="ir.ui.view">
+ <field name="name">event.registration.answer.view.search</field>
+ <field name="model">event.registration.answer</field>
+ <field name="arch" type="xml">
+ <search>
+ <field name="value_text_box" />
+ <field name="value_answer_id" />
+ <field name="question_id" />
+ </search>
+ </field>
+ </record>
+
+ <record id="event_registration_answer_view_tree" model="ir.ui.view">
+ <field name="name">event.registration.answer.view.tree</field>
+ <field name="model">event.registration.answer</field>
+ <field name="arch" type="xml">
+ <tree string="Answer Breakdown" create="0">
+ <field name="registration_id" optional="show" />
+ <field name="partner_id" optional="hide" />
+ <field name="question_id" optional="show" />
+ <field name="value_text_box" />
+ <field name="value_answer_id" string="Selected answer" />
+ </tree>
+ </field>
+ </record>
+
+ <record id="event_registration_answer_view_graph" model="ir.ui.view">
+ <field name="name">event.registration.answer.view.graph</field>
+ <field name="model">event.registration.answer</field>
+ <field name="arch" type="xml">
+ <graph string="Answer Breakdown" sample="1">
+ <field name="value_answer_id" />
+ </graph>
+ </field>
+ </record>
+
+ <record id="event_registration_answer_view_pivot" model="ir.ui.view">
+ <field name="name">event.registration.answer.view.pivot</field>
+ <field name="model">event.registration.answer</field>
+ <field name="arch" type="xml">
+ <pivot string="Answer Breakdown" sample="1">
+ <field name="registration_id" type="row"/>
+ <field name="value_answer_id" type="col"/>
+ </pivot>
+ </field>
+ </record>
+
+ <record id="action_event_registration_report" model="ir.actions.act_window">
+ <field name="name">Answer Breakdown</field>
+ <field name="res_model">event.registration.answer</field>
+ <field name="view_mode">search,tree,graph,pivot</field>
+ </record>
+</odoo>
diff --git a/addons/website_event_questions/views/event_registration_views.xml b/addons/website_event_questions/views/event_registration_views.xml new file mode 100644 index 00000000..e2ff64cc --- /dev/null +++ b/addons/website_event_questions/views/event_registration_views.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <record id="event_registration_view_form_inherit_question" model="ir.ui.view">
+ <field name="name">event.registration.view.form.inherit.question</field>
+ <field name="model">event.registration</field>
+ <field name="inherit_id" ref="event.view_event_registration_form" />
+ <field name="arch" type="xml">
+ <sheet position="inside">
+ <notebook>
+ <page string="Questions" name="questions">
+ <field name="registration_answer_ids" widget="one2many">
+ <tree editable="bottom">
+ <field name="event_id" invisible="1" />
+ <field name="question_id" domain="[('event_id', '=', event_id)]" options="{'no_create': True}" />
+ <field name="question_type" string="Type" />
+ <field name="value_answer_id"
+ attrs="{'invisible': [('question_type', '!=', 'simple_choice')]}"
+ domain="[('question_id', '=', question_id)]" options="{'no_create': True}"/>
+ <field name="value_text_box" attrs="{'invisible': [('question_type', '!=', 'text_box')]}" />
+ </tree>
+ </field>
+ </page>
+ </notebook>
+ </sheet>
+ </field>
+ </record>
+</odoo>
diff --git a/addons/website_event_questions/views/event_templates.xml b/addons/website_event_questions/views/event_templates.xml new file mode 100644 index 00000000..02c21b99 --- /dev/null +++ b/addons/website_event_questions/views/event_templates.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + +<template id="registration_attendee_details_questions" inherit_id="website_event.registration_attendee_details" name="Registration Attendee Details with questions"> + <!-- Attendee specific questions --> + <xpath expr="//t[@name='attendee_loop']//*[hasclass('modal-body')]" position="inside"> + <t t-if="event.specific_question_ids"> + <div t-foreach="event.specific_question_ids" t-as="question" class="row"> + <div class="col-lg-6 mt-2"> + <t t-call="website_event_questions.registration_event_question"> + <t t-set="registration_index" t-value="counter"/> + </t> + </div> + </div> + </t> + </xpath> + <!-- Generic questions --> + <xpath expr="//*[hasclass('modal-footer')]" position="before"> + <t t-if="event.general_question_ids"> + <div class="modal-body bg-light border-bottom o_wevent_registration_question_global"> + <div t-foreach="event.general_question_ids" t-as="question" class="row"> + <div class="col-lg-6 mt-2"> + <t t-call="website_event_questions.registration_event_question"> + <t t-set="registration_index" t-value="0"/> + </t> + </div> + </div> + </div> + </t> + </xpath> +</template> + +<template id="registration_event_question" name="Registration Event Question"> + <label t-esc="question.title"/> + <t t-if="question.question_type == 'simple_choice'"> + <select t-attf-name="question_answer-#{registration_index}-#{question.id}" class="custom-select" required="true"> + <t t-foreach="question.answer_ids" t-as="answer"> + <option t-esc="answer.name" t-att-value="answer.id"/> + </t> + </select> + </t> + <t t-elif="question.question_type == 'text_box'"> + <textarea t-attf-name="question_answer-#{registration_index}-#{question.id}" class="col-lg-12 form-control"/> + </t> +</template> + +</odoo> 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> |
