summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurélien Warnon <awa@odoo.com>2020-03-31 06:47:19 +0000
committerAurélien Warnon <awa@odoo.com>2020-03-31 10:44:00 +0000
commit1e693d0de426121f12dcf0a90065e6b36de3b003 (patch)
treec6584f378c3287ed5401c2aee970765f61038b3b
parentf508a09640130845ee30a8717b0b2fff7b3c011c (diff)
[MOV] website_event_questions: split views to appropriate files
This commit does not change anything functionally, we just move views around to appropriate xml files so that everything is organized better. At the same time, a few views were renamed to match guidelines and we removed a useless view on event.question.answer, that will only ever be edited inline or inside many2many_tags. LINKS PR #45497 Task 2189529
-rw-r--r--addons/website_event_questions/__manifest__.py2
-rw-r--r--addons/website_event_questions/views/event_question_views.xml35
-rw-r--r--addons/website_event_questions/views/event_registration_views.xml27
-rw-r--r--addons/website_event_questions/views/event_views.xml218
4 files changed, 137 insertions, 145 deletions
diff --git a/addons/website_event_questions/__manifest__.py b/addons/website_event_questions/__manifest__.py
index a85f4398839..0ab6e0f7267 100644
--- a/addons/website_event_questions/__manifest__.py
+++ b/addons/website_event_questions/__manifest__.py
@@ -9,6 +9,8 @@
'data': [
'views/assets.xml',
'views/event_views.xml',
+ 'views/event_registration_views.xml',
+ 'views/event_question_views.xml',
'views/event_templates.xml',
'security/ir.model.access.csv',
],
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 00000000000..3fec664ea5b
--- /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_views.xml b/addons/website_event_questions/views/event_registration_views.xml
new file mode 100644
index 00000000000..e2ff64cc14c
--- /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_views.xml b/addons/website_event_questions/views/event_views.xml
index 5e3c8aa6bba..9be84b95c2f 100644
--- a/addons/website_event_questions/views/event_views.xml
+++ b/addons/website_event_questions/views/event_views.xml
@@ -1,155 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
-
-<record model="ir.ui.view" id="view_event_question_form">
- <field name="name">event.question.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>
-
-<record model="ir.ui.view" id="view_event_answer_simplified_form">
- <field name="name">event.question.answer.simplified.form</field>
- <field name="model">event.question.answer</field>
- <field name="arch" type="xml">
- <form string="Answer">
- <group>
- <field name="name"/>
- </group>
- </form>
- </field>
-</record>
-
-<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_inherit_website"/>
- <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>
+ <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_inherit_website"/>
+ <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>
- </div>
- </field>
-</record>
+ </field>
+ </record>
-<record model="ir.ui.view" id="view_event_form_inherit_question">
- <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_inherit_website"/>
- <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" />
- <field name="answer_ids" widget="many2many_tags"
- attrs="{'invisible': [('question_type', '!=', 'simple_choice')]}" />
- </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>
- <group>
- <div colspan="2">
- <field name="once_per_order"/>
- <label for="once_per_order"/>
- </div>
- <field name="question_type" widget="radio" options="{'horizontal': true}" />
+ <record id="event_event_view_form_inherit_question" 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_inherit_website"/>
+ <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')]}" />
+ </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>
- </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>
-
-<record model="ir.ui.view" id="view_event_registration_form_inherit_question">
- <field name="name">event.registration.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" />
- <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>
+ <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>
- </notebook>
- </sheet>
- </field>
-</record>
-
+ </data>
+ </field>
+ </record>
</odoo>