From f652912398c2ff1ca174f47f30f7bef73605caec Mon Sep 17 00:00:00 2001 From: qmo-odoo Date: Fri, 17 Jan 2020 08:56:11 +0000 Subject: [PATCH] [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 Co-Authored-By: Quentin Mourier --- addons/website_event_questions/data/event_demo.xml | 2 +- addons/website_event_questions/models/event_event.py | 6 +++--- addons/website_event_questions/models/event_question.py | 6 +++--- addons/website_event_questions/tests/common.py | 4 ++-- addons/website_event_questions/views/event_views.xml | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/addons/website_event_questions/data/event_demo.xml b/addons/website_event_questions/data/event_demo.xml index 59f500e3f01..0a8b5e4f31b 100644 --- a/addons/website_event_questions/data/event_demo.xml +++ b/addons/website_event_questions/data/event_demo.xml @@ -2,7 +2,7 @@ Meal Type - + diff --git a/addons/website_event_questions/models/event_event.py b/addons/website_event_questions/models/event_event.py index c5c04f169f7..53e1cfc0533 100644 --- a/addons/website_event_questions/models/event_event.py +++ b/addons/website_event_questions/models/event_event.py @@ -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 ] diff --git a/addons/website_event_questions/models/event_question.py b/addons/website_event_questions/models/event_question.py index f54fbdcc83b..1081f96f6c9 100644 --- a/addons/website_event_questions/models/event_question.py +++ b/addons/website_event_questions/models/event_question.py @@ -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): diff --git a/addons/website_event_questions/tests/common.py b/addons/website_event_questions/tests/common.py index e31f0356e09..431eb1c376d 100644 --- a/addons/website_event_questions/tests/common.py +++ b/addons/website_event_questions/tests/common.py @@ -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'}) diff --git a/addons/website_event_questions/views/event_views.xml b/addons/website_event_questions/views/event_views.xml index 9359aeb0400..fb5a048e7b8 100644 --- a/addons/website_event_questions/views/event_views.xml +++ b/addons/website_event_questions/views/event_views.xml @@ -7,8 +7,8 @@

- -