Skip to content
Permalink
Browse files

[IMP] Survey: Hide retry button on print view

	-previously, The Retry button was visible on printable view of the
survey as well as on answers.
	-This commit fixes the issue by passing an extra parameter to
determine whether user is in printable view or simply in answer review.

Task: 1967500
  • Loading branch information...
hdh-odoo committed Apr 12, 2019
1 parent 04d5c36 commit 9e89616d14a99d74fea2c44ad9e77bd52df6c3dd
Showing with 4 additions and 3 deletions.
  1. +2 −1 addons/survey/controllers/main.py
  2. +2 −2 addons/survey/views/survey_templates.xml
@@ -426,7 +426,7 @@ def survey_submit(self, survey_token, answer_token, **post):
return json.dumps(ret)

@http.route('/survey/print/<string:survey_token>', type='http', auth='public', website=True)
def survey_print(self, survey_token, answer_token=None, **post):
def survey_print(self, survey_token, review=None, answer_token=None, **post):
'''Display an survey in printable view; if <answer_token> is set, it will
grab the answers of the user_input_id that has <answer_token>.'''
access_data = self._get_access_data(survey_token, answer_token, ensure_token=False)
@@ -441,6 +441,7 @@ def survey_print(self, survey_token, answer_token=None, **post):
return request.render("survey.403", {'survey': survey_sudo})

return request.render('survey.survey_print', {
'review': review,
'survey': survey_sudo,
'answer': answer_sudo,
'page_nr': 0,
@@ -45,7 +45,7 @@
</t>
<t t-call="survey.retake_survey_button"/>
<div t-if="survey.scoring_type != 'scoring_without_answers'">
If you wish, you can <a t-att-href="'/survey/print/%s?answer_token=%s' % (survey.access_token, answer.token)">review your answers</a>
If you wish, you can <a t-att-href="'/survey/print/%s?answer_token=%s&amp;review=True' % (survey.access_token, answer.token)">review your answers</a>
</div>
</div>
</div>
@@ -482,7 +482,7 @@
<div class='jumbotron mt32'>
<h1><span t-field='survey.title'/></h1>
<t t-if="survey.description"><div t-field='survey.description' class="oe_no_empty"/></t>
<t t-call="survey.retake_survey_button"/>
<t t-if="review" t-call="survey.retake_survey_button"/>
</div>
<div role="form" class="js_surveyform" t-att-name="'%s' % (survey.id)" t-att-data-prefill="'/survey/prefill/%s/%s' % (survey.access_token, answer.token)">
<t t-foreach='survey.question_and_page_ids' t-as='question'>

0 comments on commit 9e89616

Please sign in to comment.
You can’t perform that action at this time.