From 4e712fc2f9d77431b9d1876e12d4f2e2f3fe3828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Fri, 13 Sep 2019 09:02:05 +0000 Subject: [IMP] survey: mark certification documents of test entries as "specimen" When a user tests the Survey, he should not get a valid certification document when he succeeds. To avoid that, we add a "specimen" watermark on the background when the user_input is a test_entry. In addition, we also don't send the mail containing the certification for test entries. Task#2058598 --- addons/survey/models/survey_user.py | 2 +- addons/survey/static/src/img/watermark.png | Bin 0 -> 61598 bytes addons/survey/static/src/scss/survey_reports.scss | 11 ++++ addons/survey/views/survey_report_templates.xml | 60 +++++++++++----------- 4 files changed, 42 insertions(+), 31 deletions(-) create mode 100644 addons/survey/static/src/img/watermark.png (limited to 'addons') diff --git a/addons/survey/models/survey_user.py b/addons/survey/models/survey_user.py index a8dcb51e6bd..33fc0c8776a 100644 --- a/addons/survey/models/survey_user.py +++ b/addons/survey/models/survey_user.py @@ -180,7 +180,7 @@ class SurveyUserInput(models.Model): badge_ids = [] for user_input in self: if user_input.survey_id.certificate and user_input.quizz_passed: - if user_input.survey_id.certification_mail_template_id: + if user_input.survey_id.certification_mail_template_id and not user_input.test_entry: user_input.survey_id.certification_mail_template_id.send_mail(user_input.id, notif_layout="mail.mail_notification_light") if user_input.survey_id.certification_give_badge: badge_ids.append(user_input.survey_id.certification_badge_id.id) diff --git a/addons/survey/static/src/img/watermark.png b/addons/survey/static/src/img/watermark.png new file mode 100644 index 00000000000..91ec26fc9ac Binary files /dev/null and b/addons/survey/static/src/img/watermark.png differ diff --git a/addons/survey/static/src/scss/survey_reports.scss b/addons/survey/static/src/scss/survey_reports.scss index ac31d56abed..94e00e729af 100644 --- a/addons/survey/static/src/scss/survey_reports.scss +++ b/addons/survey/static/src/scss/survey_reports.scss @@ -13,5 +13,16 @@ h2 { color: #876B81; } + + &.test-entry::after { + top: 0px; + left: 0px; + position: absolute; + content: ''; + height: 610px; + width: 860px; + background: url(/survey/static/src/img/watermark.png) no-repeat; + background-size: 100% 100%; + } } } diff --git a/addons/survey/views/survey_report_templates.xml b/addons/survey/views/survey_report_templates.xml index df969747027..9d9190b547a 100644 --- a/addons/survey/views/survey_report_templates.xml +++ b/addons/survey/views/survey_report_templates.xml @@ -1,35 +1,35 @@ - - + -- cgit v1.2.3