[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
This commit is contained in:
Aurélien Warnon
2019-09-13 11:28:04 +00:00
parent 66df3f0479
commit 4e712fc2f9
4 changed files with 42 additions and 31 deletions
+1 -1
View File
@@ -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)
Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

@@ -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%;
}
}
}
+30 -30
View File
@@ -1,35 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="certification_report_view">
<t t-set="data_report_landscape" t-value="True"/>
<t t-set="full_width" t-value="True"/>
<t t-call="web.html_container">
<t t-foreach="docs" t-as="user_input">
<div t-att-data-oe-model="user_input._name" t-att-data-oe-id="user_input.id" class="article certification-wrapper">
<div class="certification">
<h2>
<span t-field="user_input.survey_id.create_uid.company_id.display_name"/>
</h2>
<p>Certifies that</p>
<h2>
<span t-esc="user_input.partner_id.name or user_input.email"/>
</h2>
<!-- You should not print a certificate if failed :) -->
<p t-if="user_input.quizz_passed">Successfully achieved</p>
<p t-if="not user_input.quizz_passed">Successfully failed</p>
<h3>
<span t-field="user_input.survey_id.display_name"/>
</h3>
<p>
<strong t-if="user_input.quizz_passed">Date of Certification:</strong>
<strong t-if="not user_input.quizz_passed">Date of Failure:</strong>
<span t-field="user_input.create_date"/>
</p>
</div>
<data>
<template id="certification_report_view">
<t t-set="data_report_landscape" t-value="True"/>
<t t-set="full_width" t-value="True"/>
<t t-call="web.html_container">
<t t-foreach="docs" t-as="user_input">
<div t-att-data-oe-model="user_input._name" t-att-data-oe-id="user_input.id" class="article certification-wrapper">
<div t-attf-class="certification #{'test-entry' if user_input.test_entry else ''}">
<h2>
<span t-field="user_input.survey_id.create_uid.company_id.display_name"/>
</h2>
<p>Certifies that</p>
<h2>
<span t-esc="user_input.partner_id.name or user_input.email"/>
</h2>
<!-- You should not print a certificate if failed :) -->
<p t-if="user_input.quizz_passed">Successfully achieved</p>
<p t-if="not user_input.quizz_passed">Successfully failed</p>
<h3>
<span t-field="user_input.survey_id.display_name"/>
</h3>
<p>
<strong t-if="user_input.quizz_passed">Date of Certification:</strong>
<strong t-if="not user_input.quizz_passed">Date of Failure:</strong>
<span t-field="user_input.create_date"/>
</p>
</div>
</t>
</div>
</t>
</template>
</data>
</t>
</template>
</data>
</odoo>