[REF] website_event_questions: inverse is_indivual field behavior and default

PURPOSE

Questions asked to attendees are usually attendee specific according to
"statistics". It makes therefore sense to have a field activating the global
question mode that is False by default.

SPECIFICATIONS

Inverse behavior of boolean 'is_individual' and rename it to 'once_per_order'.
By default it is set to False, meaning all questions are individual.

LINKS

TaskID 2162438
Community PR odoo/odoo#44476
Upgrade PR odoo/upgrade#771

Co-Authored-By: David Beguin <dbe@odoo.com>
Co-Authored-By: Quentin Mourier <qmo@odoo.com>
This commit is contained in:
qmo-odoo
2020-02-18 09:24:26 +00:00
committed by Thibault Delavallée
co-authored by David Beguin
parent 9444d25db9
commit f652912398
5 changed files with 12 additions and 12 deletions
@@ -2,7 +2,7 @@
<odoo><data>
<record id="event_0_question_0" model="event.question">
<field name="title">Meal Type</field>
<field name="is_individual" eval="False"/>
<field name="once_per_order" eval="False"/>
<field name="event_id" ref="event.event_0"/>
</record>
<record id="event_0_question_0_answer_0" model="event.answer">
@@ -19,9 +19,9 @@ class EventEvent(models.Model):
question_ids = fields.One2many('event.question', 'event_id', 'Questions', copy=True)
general_question_ids = fields.One2many('event.question', 'event_id', 'General Questions',
domain=[('is_individual', '=', False)])
domain=[('once_per_order', '=', True)])
specific_question_ids = fields.One2many('event.question', 'event_id', 'Specific Questions',
domain=[('is_individual', '=', True)])
domain=[('once_per_order', '=', False)])
@api.onchange('event_type_id')
def _onchange_type(self):
@@ -31,7 +31,7 @@ class EventEvent(models.Model):
(0, 0, {
'title': question.title,
'sequence': question.sequence,
'is_individual': question.is_individual,
'once_per_order': question.once_per_order,
})
for question in self.event_type_id.question_ids
]
@@ -16,9 +16,9 @@ class EventQuestion(models.Model):
event_id = fields.Many2one('event.event', 'Event', ondelete='cascade')
answer_ids = fields.One2many('event.answer', 'question_id', "Answers", required=True, copy=True)
sequence = fields.Integer(default=10)
is_individual = fields.Boolean('Ask each attendee',
help="If True, this question will be asked for every attendee of a reservation. If "
"not it will be asked only once and its value propagated to every attendees.")
once_per_order = fields.Boolean('Ask only once per order',
help="If True, this question will be asked only once and its value will be propagated to every attendees."
"If not it will be asked for every attendee of a reservation.")
@api.constrains('event_type_id', 'event_id')
def _constrains_event(self):
@@ -13,7 +13,7 @@ class TestEventQuestionCommon(TestEventCommon):
cls.event_question_1 = cls.env['event.question'].create({
'title': 'Question1',
'event_type_id': cls.event_type_complex.id,
'is_individual': True,
'once_per_order': False,
'answer_ids': [
(0, 0, {'name': 'Q1-Answer1'}),
(0, 0, {'name': 'Q1-Answer2'})
@@ -22,7 +22,7 @@ class TestEventQuestionCommon(TestEventCommon):
cls.event_question_2 = cls.env['event.question'].create({
'title': 'Question2',
'event_type_id': cls.event_type_complex.id,
'is_individual': False,
'once_per_order': True,
'answer_ids': [
(0, 0, {'name': 'Q2-Answer1'}),
(0, 0, {'name': 'Q2-Answer2'})
@@ -7,8 +7,8 @@
<field name="arch" type="xml">
<form string="Question">
<h1><field name="title" /></h1>
<field name="is_individual"/>
<label for="is_individual"/>
<field name="once_per_order"/>
<label for="once_per_order"/>
<field name="answer_ids">
<tree editable="bottom">
<field name="sequence" widget="handle" />
@@ -66,7 +66,7 @@
<tree>
<field name="sequence" widget="handle" />
<field name="title"/>
<field name="is_individual"/>
<field name="once_per_order"/>
<field name="answer_ids"/>
</tree>
</field>