[IMP] project: make email templates bioutifoul

Purpose of this commit is to enhance quality of templates proposed by Odoo
and make them use notification layout when send by emails. Those emails
are cleaner and more up to date compared to other emails.

Including
  * reception acknowledgment template is moved from demo to data to ensure
    people have a template to copy and use for their stages;
  * improve layout of rating request template;
  * use notification layout when sending template-based emails;
  * rename the admin spam template so that templates are correctly ordered
    when viewing them in list;

This commit is related to task ID 51122 (and PR #24052).
This commit is contained in:
Pratima Gupta
2018-06-08 15:31:59 +02:00
committed by Thibault Delavallée
parent 9eb89131f3
commit a461eba04c
2 changed files with 79 additions and 88 deletions
-14
View File
@@ -21,20 +21,6 @@
<field name="name">Usability</field>
</record>
<!-- Email templates -->
<record id="mail_template_data_project_task" model="mail.template">
<field name="name">Task: Reception Acknowledgment</field>
<field name="subject">Reception of ${object.name}</field>
<field name="model_id" ref="project.model_project_task"/>
<field name="use_default_to" eval="True"/>
<field name="body_html"><![CDATA[
<p>Dear ${object.partner_id.name or 'customer'},</p>
<p>Thank you for your enquiry.<br /></p>
<p>If you have any questions, please let us know.</p>
<p>Best regards,</p>]]></field>
<field name="auto_delete" eval="True"/>
</record>
<!-- Stages -->
<record id="project_stage_0" model="project.task.type">
<field name="sequence">1</field>
@@ -3,7 +3,7 @@
<data noupdate="1">
<!-- notify to admin of module installation -->
<record id="mail_template_data_module_install_project" model="mail.template">
<field name="name">project module install then send email</field>
<field name="name">Project: Spam admin after install</field>
<field name="subject">Your Odoo Project application</field>
<field name="email_from">help@odoo.com</field>
<field name="email_to">${user.email|safe}</field>
@@ -113,87 +113,92 @@
name="send_mail"
eval="[ref('mail_template_data_module_install_project'), ref('base.module_project')]"/>
<!-- Sample stage-related template -->
<record id="mail_template_data_project_task" model="mail.template">
<field name="name">Task: Reception Acknowledgment</field>
<field name="model_id" ref="project.model_project_task"/>
<field name="subject">Reception of ${object.name}</field>
<field name="use_default_to" eval="True"/>
<field name="body_html" type="html">
<div>
Dear ${object.partner_id.name or 'customer'},<br/>
Thank you for your enquiry.<br />
If you have any questions, please let us know.
<br/><br/>
Thank you,
<br/>
</div>
</field>
<field name="auto_delete" eval="True"/>
<field name="user_signature" eval="True"/>
</record>
<!-- Mail sent to request a rating for a task -->
<record id="rating_project_request_email_template" model="mail.template">
<field name="name">Task: Rating Request</field>
<field name="email_from">${object.rating_get_rated_partner_id().email or '' | safe}</field>
<field name="subject">${object.project_id.company_id.name}: Service Rating Request</field>
<field name="model_id" ref="project.model_project_task"/>
<field name="subject">${object.project_id.company_id.name}: Satisfaction Survey</field>
<field name="email_from">${('"%s" &lt;%s&gt;' % (object.rating_get_rated_partner_id().name, object.rating_get_rated_partner_id().email) if object.rating_get_rated_partner_id().email else '') | safe}</field>
<field name="partner_to" >${object.rating_get_partner_id().id}</field>
<field name="auto_delete" eval="True"/>
<field name="body_html"><![CDATA[
<div style="background:#F0F0F0;color:#515166;padding:10px 0px;font-family:Arial,Helvetica,sans-serif;font-size:14px;">
<field name="body_html" type="html">
<div>
% set access_token = object.rating_get_access_token()
<table style="width:600px;margin:5px auto;">
<tbody>
<tr><td>
<a href="/"><img src="/web/binary/company_logo" style="vertical-align:baseline;max-width:100px;" /></a>
</td><td style="text-align:right;vertical-align:middle;">
Satisfaction Survey
</td></tr>
</tbody>
</table>
<table style="width:600px;margin:0px auto;background:white;border:1px solid #e1e1e1;">
<tbody>
<tr><td style="padding:15px 20px 10px 20px;">
<p>Hello,</p>
<p>Please take a moment to rate our services related to the task "<strong>${object.name}</strong>"
assigned to <strong>${object.rating_get_rated_partner_id().name}</strong>.</p>
<p>We appreciate your feedback. It helps us to improve continuously.</p>
</td></tr>
<tr><td style="padding:10px 20px">
<table summary="o_mail_notification" style="width:100%;border-top:1px solid #e1e1e1;">
<tr>
<td style="text-align:center;">
<h2 style="font-weight:300;font-size:18px;">
Tell us how you feel about our service:
</h2>
<div style="text-color: #888888">(click on one of these smileys)</div>
</td>
</tr>
<tr>
<td style="padding:10px 10px;">
<table style="width:100%;text-align:center;">
<tr>
<td>
<a href="/rating/${access_token}/10">
<img alt="Satisfied" src="/rating/static/src/img/rating_10.png" title="Satisfied"/>
</a>
</td>
<td>
<a href="/rating/${access_token}/5">
<img alt="Not satisfied" src="/rating/static/src/img/rating_5.png" title="Not satisfied"/>
</a>
</td>
<td>
<a href="/rating/${access_token}/1">
<img alt="Highly Dissatisfied" src="/rating/static/src/img/rating_1.png" title="Highly Dissatisfied"/>
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td></tr>
<tr><td style="padding:15px 20px 10px 20px;">${(object.user_id.signature or '')| safe}</td></tr>
</tbody>
</table>
<table style="width:600px;margin:auto;text-align:center;font-size:12px;">
<tbody>
<tr><td style="padding-top:10px;color:#afafaf;">
% if object.project_id.rating_status == 'stage':
<p>This customer survey has been sent because your task has been moved to the stage <b>${object.stage_id.name}</b></p>
% endif
% if object.project_id.rating_status == 'periodic':
<p>This customer survey is sent <b>${object.project_id.rating_status_period}</b> as long as the task is in the <b>${object.stage_id.name}</b> stage.</p>
% endif
<p>Email automatically sent by <a target="_blank" href="https://www.odoo.com/page/project-management" style="color:#875A7B;text-decoration:none;">Odoo Project</a> for <a href="${object.project_id.company_id.website}" style="color:#875A7B;text-decoration:none;">${object.project_id.company_id.name}</a></p>
</td></tr>
</tbody>
% set partner = object.rating_get_partner_id()
<table border="0" cellpadding="0" cellspacing="0" width="590" style="width:100%; margin:0px auto;">
<tbody>
<tr><td valign="top" style="font-size: 14px;">
Hello ${partner.name},<br/>
Please take a moment to rate our services related to the task "<strong>${object.name}</strong>"
% if object.rating_get_rated_partner_id().name:
assigned to <strong>${object.rating_get_rated_partner_id().name}</strong>.<br/>
% else:
.<br/>
% endif
</td></tr>
<tr><td style="text-align: center;">
<table border="0" cellpadding="0" cellspacing="0" width="590" summary="o_mail_notification" style="width:100%; margin: 32px 0px 32px 0px;">
<tr><td style="font-size: 14px;">
<strong>Tell us how you feel about our service</strong><br/>
<span style="text-color: #888888">(click on one of these smileys)</span>
</td></tr>
<tr><td style="font-size: 14px;">
<table style="width:100%;text-align:center;">
<tr>
<td>
<a href="/rating/${access_token}/10">
<img alt="Satisfied" src="/rating/static/src/img/rating_10.png" title="Satisfied"/>
</a>
</td>
<td>
<a href="/rating/${access_token}/5">
<img alt="Not satisfied" src="/rating/static/src/img/rating_5.png" title="Not satisfied"/>
</a>
</td>
<td>
<a href="/rating/${access_token}/1">
<img alt="Highly Dissatisfied" src="/rating/static/src/img/rating_1.png" title="Highly Dissatisfied"/>
</a>
</td>
</tr>
</table>
</td></tr>
</table>
</td></tr>
<tr><td valign="top" style="font-size: 14px;">
We appreciate your feedback. It helps us to improve continuously.
% if object.project_id.rating_status == 'stage':
<br/><span style="margin: 0px 0px 0px 0px; font-size: 12px; opacity: 0.5; color: #454748;">This customer survey has been sent because your task has been moved to the stage <b>${object.stage_id.name}</b></span>
% endif
% if object.project_id.rating_status == 'periodic':
<br/><span style="margin: 0px 0px 0px 0px; font-size: 12px; opacity: 0.5; color: #454748;">This customer survey is sent <b>${object.project_id.rating_status_period}</b> as long as the task is in the <b>${object.stage_id.name}</b> stage.</span>
% endif
</td></tr>
</tbody>
</table>
</div>
]]></field>
</field>
<field name="auto_delete" eval="True"/>
<field name="user_signature" eval="False"/>
</record>
</data>
</odoo>