[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 closes odoo/odoo#32618 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -426,7 +426,7 @@ class Survey(http.Controller):
|
||||
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=False, 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 @@ class Survey(http.Controller):
|
||||
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&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'>
|
||||
|
||||
Reference in New Issue
Block a user