summaryrefslogtreecommitdiff
path: root/addons/survey/controllers/main.py
diff options
context:
space:
mode:
authorAurélien Warnon <awa@odoo.com>2019-04-23 12:05:29 +0000
committerAurélien Warnon <awa@odoo.com>2019-04-23 12:05:29 +0000
commitd6f07e659d245731dc812854aa454ebcdbca9441 (patch)
treeaa7bc39aead959d79aa45a6b520b84a5c0a3085c /addons/survey/controllers/main.py
parent62533ec752b1ba711e91219880b3efb6a4f1b491 (diff)
[REF] survey: add a "_mark_done" method to improve answers state management
As other modules than survey (namely hr_skills) now need a hook to add specific behavior when a survey answer is marked as 'done', we removed the '_send_certification' method and replaced it with a '_mark_done' method. It will make it easier to override this method as it has a more generic meaning. closes odoo/odoo#32880 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons/survey/controllers/main.py')
-rw-r--r--addons/survey/controllers/main.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py
index 56f00eb287c..e8552c45b7a 100644
--- a/addons/survey/controllers/main.py
+++ b/addons/survey/controllers/main.py
@@ -405,20 +405,18 @@ class Survey(http.Controller):
if answer_sudo.is_time_limit_reached or survey_sudo.questions_layout == 'one_page':
go_back = False
- answer_sudo._send_certification()
- vals = {'state': 'done'}
+ answer_sudo._mark_done()
else:
go_back = post['button_submit'] == 'previous'
next_page, last = request.env['survey.survey'].next_page_or_question(answer_sudo, page_or_question_id, go_back=go_back)
vals = {'last_displayed_page_id': page_or_question_id}
if next_page is None and not go_back:
- answer_sudo._send_certification()
- vals.update({'state': 'done'})
+ answer_sudo._mark_done()
else:
vals.update({'state': 'skip'})
+ answer_sudo.write(vals)
- answer_sudo.write(vals)
ret['redirect'] = '/survey/fill/%s/%s' % (survey_sudo.access_token, answer_token)
if go_back:
ret['redirect'] += '?prev=prev'