summaryrefslogtreecommitdiff
path: root/addons/purchase/data/mail_template_data.xml
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2018-01-12 11:34:30 +0100
committerThibault Delavallée <tde@odoo.com>2018-01-29 16:48:23 +0100
commit0f301bec25dd6d76fd6ac23275a82e0a32886bbc (patch)
treed9ef2ec0d5235a87dd05c96a0cd30897a3226a20 /addons/purchase/data/mail_template_data.xml
parentd1ec600c432b0f47a40e6655a1e462213c4ad5a1 (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/purchase/data/mail_template_data.xml')
-rw-r--r--addons/purchase/data/mail_template_data.xml132
1 files changed, 49 insertions, 83 deletions
diff --git a/addons/purchase/data/mail_template_data.xml b/addons/purchase/data/mail_template_data.xml
index a2d1a7eb0e3..461df29c9dc 100644
--- a/addons/purchase/data/mail_template_data.xml
+++ b/addons/purchase/data/mail_template_data.xml
@@ -77,89 +77,55 @@ from ${object.company_id.name}.
]]></field>
</record>
-
<!--Default Notification Email template for invoices-->
- <record id="purchase.mail_template_data_notification_email_purchase_order" model="mail.template">
- <field name="name">Purchase Order 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"><![CDATA[<html>
- <head></head>
- <body style="margin: 0; padding: 0;">
- <table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed" summary="o_mail_notification">
- <tbody>
-
- <!-- HEADER -->
- <tr>
- <td align="center" style="min-width: 590px;">
- <table width="590" 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="590" border="0" cellpadding="0" bgcolor="#ffffff" style="min-width: 590px; background-color: rgb(255, 255, 255); padding: 20px;">
- <tbody>
- <td valign="top" style="font-family:Arial,Helvetica,sans-serif; color: #555; font-size: 14px;">
- ${object.body | safe}
- </td>
- </tbody>
- </table>
- </td>
- </tr>
-
- <!-- FOOTER -->
- <tr>
- <td align="center" style="min-width: 590px;">
- <table width="590" 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>
- </body>
- </html>
- ]]></field>
- </record>
-
-
-
-
-
-
+ <template id="mail_notification_purchase">
+<table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed" summary="o_mail_notification">
+ <tbody><!-- HEADER --><tr>
+ <td align="center" style="min-width: 590px;">
+ <table width="590" 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 t-esc="message.record_name"/>
+ </span>
+ </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="590" border="0" cellpadding="0" bgcolor="#ffffff" style="min-width: 590px; background-color: rgb(255, 255, 255); padding: 20px;">
+ <tbody>
+ <td valign="top" style="font-family:Arial,Helvetica,sans-serif; 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="590" 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>