odoo/odoo#189738

Created by Bugfix, Andrzej Pietrusiak (pian)
Merged at f49a3445b2fb259333151ffa3c7b5197e0e9c309

Statuses:

label
odoo-dev:17.0-opw-4292331-general_survey_print_with_token_access-pian
head
90d14a9bfe7140b91564aafa726b9742d2e4931d
merged
5 months ago by SM Learn, Florian Charlier (flch)
odoo/odoo
17.0 #189738
18.0 #211529

[FIX] survey: allow survey print without answers

[FIX] survey: allow survey print without answers

Issue

Previously, printing a survey with access mode set to "invited people only"
required an existing survey.user_input record.
Without it, the print route failed silently and redirected to the homepage.

FIX

This commit allows surveys to be printed without answers.
It introduces an option to bypass the "token_required" validity check
by allowing ensure_token='survey_only'. This skips token validation
specifically for the print route, while preserving it for the start route.

Reproduce

  • -i survey
  • create new Survey, with "Access Mode": "invited people only"
  • click "Print" BUG -> taken to the odoo main page, instead of empty printed survey

opw-4292331

---

LEGACY notes BELOW


[FIX] survey: allow survey print without answers

When we set access mode to token, we need
to have existing registration survey.user_input to print the survey.

After this commit existing answer is not required anymore

Reproduce

  • -i survey
  • create new Survey, with "Access Mode": "invited people only"
  • click "Print" BUG -> taken to the odoo main page, instead of empty printed survey

opw-4292331


Note on other solutions

Initially explored approach was just to add a set of dummy/test answers

[FIX] survey: create empty answer when token access set

... to allow general print of the survey.

When we set access mode to token, we need
to have existing registration survey.user_input to print the survey.

This commit suggest solution similar to the one existing in survey_test,
so if we create test answer to use it.

Reproduce

  • -i survey
  • create new Survey, with "Access Mode": "invited people only"
  • click "Print" BUG -> taken to the odoo main page, instead of empty printed survey

Def

What I refer to as "General print" of the survey is a request to print survey without answer_token.
This is currently possible to request from the form view of the survey.survey

image

opw-4292331