diff options
| author | Thibault Delavallée <tde@odoo.com> | 2018-01-12 11:34:30 +0100 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2018-01-29 16:48:23 +0100 |
| commit | 0f301bec25dd6d76fd6ac23275a82e0a32886bbc (patch) | |
| tree | d9ef2ec0d5235a87dd05c96a0cd30897a3226a20 /addons/delivery/data | |
| parent | d1ec600c432b0f47a40e6655a1e462213c4ad5a1 (diff) | |
[REF] mail: move email notification templates to QWeb
In this commit we change notification templates used to render
notification emails from jinja-based mail.template to pure QWeb
templates.
There are several reasons to do so
* those are not real mail.template records. Indeed they cannot be used
outside of the notification process as some values are computed
and not available on the mail.message record used to render the
template;
* we do not really need other fields than body. Indeed fields like
subject, email_from or email_to are computed from the notification
process;
* we do not want people to update the mail.template without knowing
the consequences, especially for fields like recipients that may
broke the mail gateway;
* using the html editor easily break the mail.template as it is very
custom and very to break without really realizing it.
It also simplifies template management as it lessens number of mail
template people have in their list view of mail.template. It avoids
mixing technical and functional templates.
We move to QWeb templates as those are not too hard to customize and
allow to perform body rendering which is what we really need when
notifying people of a new message.
This commit does not change the functional purpose and layout of the
templates. Behavior should be the same before and after this commit.
Diffstat (limited to 'addons/delivery/data')
| -rw-r--r-- | addons/delivery/data/mail_template_data.xml | 104 |
1 files changed, 45 insertions, 59 deletions
diff --git a/addons/delivery/data/mail_template_data.xml b/addons/delivery/data/mail_template_data.xml index 7f06198d9a9..53e9bb17ae4 100644 --- a/addons/delivery/data/mail_template_data.xml +++ b/addons/delivery/data/mail_template_data.xml @@ -26,64 +26,50 @@ <p>Thank you,</p> </field> </record> - <!--Email Notification template for Delivery--> - <record id="mail_template_data_delivery_notification" model="mail.template"> - <field name="name">Delivery: Custom Notification Email</field> - <field name="subject">${object.subject}</field> - <field name="model_id" ref="mail.model_mail_message"/> - <field name="auto_delete" eval="True"/> - <field name="body_html" type="xml"> - <table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="font-family:Arial,Helvetica,sans-serif; padding: 20px; background-color: #ededed" summary="o_mail_notification"> - <tbody> - <!-- HEADER --> - <tr> - <td align="center" style="min-width: 590px;"> - <table width="650" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> - <tr> - <td valign="middle"> - <span style="font-size:20px; color:white; font-weight: bold;">${object.record_name}</span> - </td> - <td valign="middle" align="right"> - <img src="/logo.png" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}"/> - </td> - </tr> - </table> - </td> - </tr> - <!-- CONTENT --> - <tr> - <td align="center" style="min-width: 590px;"> - <table width="650" border="0" cellpadding="0" bgcolor="#ffffff" style="min-width: 590px; background-color: rgb(255, 255, 255); padding: 20px;"> - <tbody> - <td valign="top" style="color: #555; font-size: 14px;">${object.body | safe}</td> - </tbody> - </table> - </td> - </tr> - <!-- FOOTER --> - <tr> - <td align="center" style="min-width: 590px;"> - <table width="650" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> - <tr> - <td valign="middle" align="left" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;">${user.company_id.name}<br/>${user.company_id.phone or ''}</td> - <td valign="middle" align="right" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"> - % if user.company_id.email: - <a href="mailto:${user.company_id.email}" style="text-decoration:none; color: white;">${user.company_id.email}</a><br/> - % endif - % if user.company_id.website: - <a href="${user.company_id.website}" style="text-decoration:none; color: white;">${user.company_id.website}</a> - % endif - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td align="center">Powered by <a href="https://www.odoo.com">Odoo</a>.</td> - </tr> - </tbody> - </table> - </field> - </record> + + <template id="mail_notification_delivery"> +<table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="font-family:Arial,Helvetica,sans-serif; padding: 20px; background-color: #ededed" summary="o_mail_notification"> + <tbody><!-- HEADER --><tr> + <td align="center" style="min-width: 590px;"> + <table width="650" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> + <tr><td valign="middle"> + <span style="font-size:20px; color:white; font-weight: bold;" t-field="message.record_name"/> + </td><td valign="middle" align="right"> + <img t-att-src="'/logo.png?company=%s' % company.id" style="padding: 0px; margin: 0px; height: auto; width: 80px;" t-att-alt="'%s' % company.name"/> + </td></tr> + </table> + </td> + </tr><!-- CONTENT --><tr> + <td align="center" style="min-width: 590px;"> + <table width="650" border="0" cellpadding="0" bgcolor="#ffffff" style="min-width: 590px; background-color: rgb(255, 255, 255); padding: 20px;"> + <tbody> + <td valign="top" style="color: #555; font-size: 14px;"><t t-raw="message.body"/></td> + </tbody> + </table> + </td> + </tr><!-- FOOTER --><tr> + <td align="center" style="min-width: 590px;"> + <table width="650" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> + <tr><td valign="middle" align="left" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"> + <t t-esc="company.name"/><br/> + <t t-esc="company.phone"/> + </td><td valign="middle" align="right" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"> + <t t-if="company.email"> + <a t-att-href="'mailto:%s' % company.email" style="text-decoration:none; color: white;"><t t-esc="company.email"/></a><br/> + </t> + <t t-if="company.website"> + <a t-att-href="'%s' % company.website" style="text-decoration:none; color: white;"> + <t t-esc="company.website"/> + </a> + </t> + </td></tr> + </table> + </td> + </tr> + <tr> + <td align="center">Powered by <a href="https://www.odoo.com">Odoo</a>.</td> + </tr></tbody> +</table> + </template> </data> </odoo> |
