Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Surveys

Entity: survey.question

Compute Method: _compute_question_ids

View 17.0 View 19.0
Inputs Method Outputs
  • is_page
  • survey_id
  • survey_id.question_ids
- """Will take all questions of the survey for which the index is higher than the index of this page
-         and lower than the index of the next page."""
for question in self:
            if question.is_page:
-                 next_page_index = False
-                 for page in question.survey_id.page_ids:
-                     if page._index() > question._index():
-                         next_page_index = page._index()
-                         break
- 
-                 question.question_ids = question.survey_id.question_ids.filtered(
-                     lambda q: q._index() > question._index() and (not next_page_index or q._index() < next_page_index)
-                 )
+                 question.question_ids = question.survey_id.question_ids\
+                     .filtered(lambda q: q.page_id == question).sorted(lambda q: q._index())
            else:
                question.question_ids = self.env['survey.question']
  • question_ids

Back to entity