summaryrefslogtreecommitdiff
path: root/addons/mail/data/mail_data.xml
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2015-05-22 17:11:32 +0200
committerThibault Delavallée <tde@openerp.com>2015-08-28 17:30:42 +0200
commit01ab75f597d6ff8f3f570b4c316179654caf7b1c (patch)
tree2dd960239d0fa85fa58d27709166204544b6cf2e /addons/mail/data/mail_data.xml
parent205e9f4ac0ec83d7db0eb9733a142a59d3592aac (diff)
[IMP] mail: notification emails with button
Notification emails have been redesigned. They notably include buttons allowing to perform some action directly from the email. The notification creation and sending has been partially rewritten and improved. The purpose is to lessen the number of rendering to perform when sending emails to recipients. Recipients are first categorized into groups. Basic groups are partners and users. The notification template is then rendered twice, one for followers and one for not-followers. In most cases there will be few rendering to perform. Through inheritance it is possible to further categorize users. For example HR users / officers that have approve / refuse buttons in their email. A custom data structure is used to store data about buttons and actions. URLs, follow / unfollow are added in the structure and used in the template to render the email for a given group. New routes are added in mail. Those allow to perform some action, like going to a form in create mode, following / unfollowing, executing a method, sending a signal for a workflow. Those routes are for users only and rely on classic access rights. A generic route for viewing records is added. It replaces the old redirect action. According to some specific action given by the already-existing get_access_action, the record will be visible for everybody (forum, blog) or restricted (going on the Inbox / login / form view, according to access rights). The next commit will add the various inherits necessary to add the actions in the main addons.
Diffstat (limited to 'addons/mail/data/mail_data.xml')
-rw-r--r--addons/mail/data/mail_data.xml113
1 files changed, 113 insertions, 0 deletions
diff --git a/addons/mail/data/mail_data.xml b/addons/mail/data/mail_data.xml
index 987fe6e2911..ca5ee18b468 100644
--- a/addons/mail/data/mail_data.xml
+++ b/addons/mail/data/mail_data.xml
@@ -74,5 +74,118 @@
<field name="internal" eval="True"/>
<field name="sequence" eval="100"/>
</record>
+
+ </data>
+ <data>
+ <!--Default Notification Email template -->
+ <record id="mail_template_data_notification_email_default" model="mail.template">
+ <field name="name">Notification Email</field>
+ <field name="subject">${object.subject or (object.record_name and 'Re: %s' % object.record_name) or (object.parent_id and object.parent_id.subject and 'Re: %s' % object.parent_id.subject) or (object.parent_id and object.parent_id.record_name and 'Re: %s' % object.parent_id.record_name)}</field>
+ <field name="model_id" ref="mail.model_mail_message"/>
+ <field name="auto_delete" eval="True"/>
+ <field name="body_html"><![CDATA[
+<div itemscope itemtype="http://schema.org/EmailMessage">
+ <div itemprop="potentialAction" itemscope itemtype="http://schema.org/ViewAction">
+ <link itemprop="target" href="${ctx['button_access']['url']}"/>
+ <link itemprop="url" href="${ctx['button_access']['url']}"/>
+ <meta itemprop="name" content="View ${ctx['model_name']}"/>
+ </div>
+</div>
+<div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777" data-snippet-theme="basic_theme">
+ <table cellspacing="0" cellpadding="0" style="width:600px;border-collapse:collapse;background:inherit;color:inherit">
+ <tbody><tr>
+ <td valign="center" width="270" style="padding:10px 10px 10px 5px;font-size: 30px">
+ % if ctx.get('button_access'):
+ <a href="${ctx['button_access']['url']}" style="-webkit-user-select: none; padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px" class="o_default_snippet_text">${ctx['button_access']['title']}</a>
+ % endif
+
+ % if ctx.get('button_follow'):
+ <a href="${ctx['button_follow']['url']}" style="-webkit-user-select: none; padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px" class="o_default_snippet_text">${ctx['button_follow']['title']}</a>
+
+ % elif ctx.get('button_unfollow'):
+ <a href="${ctx['button_unfollow']['url']}" style="-webkit-user-select: none; padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#a24689; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #a24689; border: 1px solid #a24689; border-radius:3px" class="o_default_snippet_text">${ctx['button_unfollow']['title']}</a>
+ % endif
+
+ % if not ctx.get('button_access') and not ctx.get('button_follow') and not ctx.get('button_unfollow') and ctx.get('model_name'):
+ <p style="padding: 5px 10px; font-size: 12px;"">
+ About <strong>${ctx['model_name']}
+ % if ctx.get('record_name'):
+ : ${ctx['record_name']}
+ % endif
+ </strong>
+ </p>
+ % endif
+ </td>
+ <td valign="center" align="right" width="270" style="padding:10px 15px 10px 10px; font-size: 12px;">
+ <p>
+ % if ctx.get('actions'):
+ % for action in ctx['actions']:
+ <a href="${action['url']}" style="text-decoration:none; color: #a24689;"><strong>${action['title']}</strong></a>
+ %if len(ctx['actions']) > 1 and loop.index < len(ctx['actions']):
+ |
+ % endif
+ % endfor
+ % else:
+ <strong>Sent by</strong>
+ % if ctx.get('website_url'):
+ <a href="${ctx['website_url']}" style="text-decoration:none; color: #a24689;">
+ % endif
+ <strong>${ctx.get('company_name')}</strong>
+ % if ctx.get('website_url'):
+ </a>
+ % endif
+ <strong>using</strong>
+ <a href="www.odoo.com" style="text-decoration:none; color: #a24689;"><strong>Odoo</strong></a>
+ % endif
+ </td>
+ </tr>
+ </tbody></table>
+</div>
+<div style="padding:0px;width:600px;margin:auto;color:#777777;background-color:#FFFFFF" class="">
+ <table cellspacing="0" cellpadding="0" style="vertical-align:top;padding:0px;font-family:arial;font-size:12px;border-collapse:collapse;background:inherit;color:inherit">
+ <tbody>
+ <tr>
+ <td valign="top" style="width:600px">
+ <div>
+ <hr width="100%" style="background-color:rgb(204,204,204);border:medium none;clear:both;display:block;font-size:0px;min-height:1px;line-height:0;margin:15px auto;padding:0">
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+<div class="snippet_row bg-color" style="padding:0;width:600px;max-width:600px;margin:0 auto;background: #fff repeat top /100%;color:#777777">
+ <table style="width:100%;text-align:justify;margin:0 auto;background:inherit;color:inherit;border-collapse:collapse;color:inherit">
+ <tbody><tr>
+ <td style="padding:10px 30px; font-size:14px">
+ ${object.body | safe}
+ % if ctx.get('tracking'):
+ % for tracking in ctx['tracking']
+ ${tracking[0]} : ${tracking[1]} -> ${tracking[2]}
+ % endfor
+ % endif
+ </td>
+ </tr>
+ </tbody></table>
+</div>
+% if ctx.get('signature'):
+<div class="snippet_row bg-color" style="padding:0px;width:600px;margin:auto;background: #fff repeat top /100%;color:#777777">
+ <center>
+ <table width="600" cellspacing="0" cellpadding="0" border="0" style="margin: 0 auto; width:600px; border-collapse:collapse;background:inherit;color:inherit">
+ <tbody><tr>
+ <td style="font-size:12px; padding: 5px 30px; text-align: left;">
+ &nbsp;
+ ${ctx['signature'] | safe}
+ &nbsp;
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </center>
+</div>
+% endif
+]]></field>
+ </record>
+
</data>
</openerp>