-
Couldn't load subscription status.
- Fork 30.2k
[FIX] survey: allow survey print without answers #189738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] survey: allow survey print without answers #189738
Conversation
75c41ab to
1921e39
Compare
|
Hello 👋 Passing by! In the survey controller I originally thought of changing the condition to use the if not answer_sudo and ensure_token and survey_sudo.access_mode == 'token':Because in the survey/print route the However this won't work because the survey_start route is also setting this @nd-dew 's approach here is to create a dummy test user.input record so that the |
1921e39 to
8fad61d
Compare
|
Added test |
|
Temporary Reverted Previous FIX -> Experiment: alter |
c6d623e to
f638799
Compare
|
@std-odoo this seem to work, but isn't that too general of a change ? |
|
@nd-dew Hi We talk about that a long time ago, but iirc, the idea was to have 2 values for ensure_token no ? |
|
Hey, I see I misunderstood your approach in there, let me introduce ensure_token set to |
278b8d5 to
3055e87
Compare
|
Seems to work fine, squash & clean |
3055e87 to
93d4415
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@flch-odoo what do you think about this approach ? |
93d4415 to
3a63db5
Compare
|
Runbot failure on seemingly unrelated tests -> r-basing @flch-odoo tried to address your comments does the PR look more sensible now? |
3a63db5 to
a68b223
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the update, @nd-dew !
I have a few questions to simplify further.
Cheers!
363c3ba to
5e9ec4b
Compare
Update
and rebased |
5aac5af to
c46e8f1
Compare
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
c46e8f1 to
90d14a9
Compare
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 closes #189738 Signed-off-by: Florian Charlier (flch) <flch@odoo.com>
Steps to reproduce: 1. Install appraisals 2. appraisals > configuration menu > settings > check '360 feedback' 3. appraisals > configuration > 360 feedback 4. Open any survey with 'invite people only' access mode or 5. Create a survey with no questions and 'invite people only' access mode. 6. Print it. Issue: Clicking the print button redirects to the homepage instead of opening the survey template. cause: The access check incorrectly redirects users additionally this pr was not backported that skips token validation specifically for the print route to redirect on print page even when no questions are added. odoo#189738 Solution: Backport the pr : odoo#189738. opw:4878800


[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_inputrecord.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 validationspecifically for the print route, while preserving it for the start route.
Reproduce
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_inputto print the survey.After this commit existing answer is not required anymore
Reproduce
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_inputto 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
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
opw-4292331