[FIX] survey: missing questions without section in survey

Since commit https://github.com/odoo/odoo/commit/dba478332681dd21a39c4a183c002b1cf6e046d2, a survey can have questions with no section
associated, which means 'page_ids' field will be empty.

This prevents to display some questions of a survey, as we are
still expecting a structure page/questions. To solve it, we first
append questions with no sections, then all other questions.

closes odoo/odoo#39113

X-original-commit: 149657cfd696e5065b55519927973fa785cc0e22
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
This commit is contained in:
alt-odoo
2019-10-21 11:28:03 +00:00
committed by fw-bot
parent 6973dfbaef
commit 54df22c112
+7 -3
View File
@@ -298,6 +298,13 @@ class Survey(models.Model):
questions = self.env['survey.question']
# First append questions without page
for question in self.question_ids:
if not question.page_id:
questions |= question
# Then, questions in sections
for page in self.page_ids:
if self.questions_selection == 'all':
questions |= page.question_ids
@@ -307,9 +314,6 @@ class Survey(models.Model):
else:
questions |= page.question_ids
if not questions:
questions = self.question_ids
return questions
def _has_attempts_left(self, partner, email, invite_token):