Files
odoo_source/addons/digest/data/digest_data.xml
T
Thibault Delavallée 99c2c2ee1e [REF] digest: move template to QWeb
PURPOSE

Make digest email and tips more appealing. The goals of these tips are

  * to encourage the adoption of other apps (Did you know ?);
  * to make Odoo look more fun (Fun tips and tricks, young and dynamic style);
  * to show social proof and increase trust (emphasis on already existing
    projects / customers to);

SPECIFICATIONS

Digest now use qweb views instead of a standard mail.template record for
rendering as

  * template is very custom;
  * probability of breaking it while edition the mail template is high;
    it is easier to maintain and extend in qweb;
  * only body was really used, other mail-related fields were not used;

We therefore remove the mail template data and the field used for it on
the digest model. Template is now forced to a Qweb view.

We can also remove the template_id field. Indeed we think that having
different templates for digests is a really advanced use case we do not
want to support.

Finally kpis and action computation is rewritten. It now returns an unique
structure containing all information in a more neutral way, holding values
for 3 columns. Purpose is to be less date-oriented in data construct and
allow people to use digest qweb template to display a 3-columns KPIs content
even if not related to yesterday / last 7 days / last 30 days.

LINKS

Task ID 2197417
Community PR odoo/odoo#51619
Upgrade PR odoo/upgrade#1256
2020-06-04 15:20:08 +00:00

246 lines
14 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo><data noupdate="1">
<!-- Email layout: encapsulation when sending (not used in backend display) -->
<template id="digest_mail_layout">
&lt;!DOCTYPE html&gt;
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
<style type="text/css">
body {
margin: 0;
padding: 0;
}
@media only screen and (max-width:650px) {
.d-block{
display: block !important;
}
.mobile-hide{
display: none !important;
}
.mobile-w-75{
width: 75% !important;
}
.mobile-w-33{
width: 33% !important;
}
.font-25{
font-size: 25px !important;
line-height: 25px !important;
}
.font-18{
font-size: 18px !important;
line-height: 25px !important;
}
.font-16{
font-size: 16px !important;
line-height: 25px !important;
}
.font-12{
font-size: 12px !important;
line-height: 20px !important;
}
}
</style>
</head>
<body>
<t t-raw="body"/>
</body>
</html>
</template>
<!-- DIGEST MAIN TEMPLATE -->
<template id="digest_mail_main">
<div style="margin:0; padding:0">
<table cellspacing="0" cellpadding="0" align="center" border="0" bgcolor="#eeeeee" style="width:100%; font-family: Arial,Helvetica,Verdana,sans-serif;">
<tr class="mobile-hide" bgcolor="#875a7b"><td height="70"> </td></tr>
<tr bgcolor="#875a7b">
<td align="center" valign="top">
<table bgcolor="#ffffff" cellspacing="0" cellpadding="0" width="650" align="center" border="0" style="border: 1px solid #eeeeee;width: 100%; max-width: 650px; padding: 30px 30px">
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" width="580" align="center" style="width:100%; max-width:580px;">
<tr>
<td class="mobile-w-75" style="text-align: left;">
<span class="font-16" style="color:#8F8F8F;font-weight:bold;font-size: 20px; line-height: 30px;" t-field="company.name"/>
<br/>
<span class="font-18" style="color:#282f33;font-weight:bold;font-size: 25px; line-height: 35px; margin-right: 5px;" t-field="object.name"/>
<span class="d-block font-12" style="color:#8F8F8F;font-size: 15px;"><t t-esc="datetime.today().strftime('%B %d, %Y')"/></span>
</td>
<td valign="top" style="text-align:right;">
<a href="/web/login" target="_blank" style="display:block;background-color:#875a7b;line-height:40px;text-decoration: none;color: #ffffff;border-radius: 3px;font-size:13px;font-weight:bold;text-align:center;">Connect</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table t-if="tips" cellspacing="0" cellpadding="0" align="center" border="0" bgcolor="#eeeeee" style="width:100%; font-family: Arial,Helvetica,Verdana,sans-serif;">
<tr>
<td align="center" valign="top">
<table bgcolor="#ffffff" cellspacing="0" cellpadding="0" width="650" align="center" border="0" style="border: 1px solid #eeeeee; border-bottom: none;width: 100%; max-width: 650px; padding:30px 30px">
<tr>
<td>
<table t-foreach="tips" t-as="tip" cellspacing="0" cellpadding="0" border="0" width="580" align="center" style="width:100%; max-width:580px;">
<tr>
<td valign="top">
<t t-raw="tip"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table t-if="kpi_data" cellspacing="0" cellpadding="0" align="center" border="0" bgcolor="#eeeeee" style="width:100%; font-family: Arial,Helvetica,Verdana,sans-serif;">
<tr>
<td align="center" valign="top">
<table bgcolor="#ffffff" cellspacing="0" cellpadding="0" width="650" align="center" border="0" style="border: 1px solid #eeeeee; border-bottom: none;width: 100%; max-width: 650px; padding:30px 30px">
<tr t-foreach="kpi_data" t-as="kpi_info">
<td>
<table cellspacing="0" cellpadding="0" border="0" width="580" align="center" style="width:100%; max-width:580px;">
<tr>
<td align="left" style="border-bottom: 1px solid #eeeeee;">
<span style="color:#282f33;font-size: 15px; font-weight: bold; line-height: 30px" t-esc="kpi_info['kpi_fullname']"/>
<a t-if="kpi_info['kpi_action']" t-att-href="'/web#action=%s' % kpi_info['kpi_action']"
style="float:right; background-color:#875A7B;margin-left: 5px; padding: 5px 12px 5px 12px; text-decoration: none; color: #ffffff; border-radius: 3px; font-size:13px; font-weight:bold; margin-bottom: 5px;">
View
</a>
</td>
</tr>
<tr>
<td>
<table cellspacing="0" cellpadding="0" align="center" border="0" style="width:100%; padding: 20px 0;">
<tr valign="top">
<td class="mobile-w-33" width="196" style=" text-align: center;">
<t t-call="digest.digest_tool_kpi">
<t t-set="kpi_value" t-value="kpi_info['kpi_col1']['value']"/>
<t t-set="kpi_margin" t-value="kpi_info['kpi_col1']['margin']"/>
<t t-set="kpi_subtitle" t-value="kpi_info['kpi_col1']['col_subtitle']"/>
</t>
</td>
<td class="mobile-w-33" width="196" style=" text-align: center;">
<t t-call="digest.digest_tool_kpi">
<t t-set="kpi_value" t-value="kpi_info['kpi_col2']['value']"/>
<t t-set="kpi_margin" t-value="kpi_info['kpi_col2']['margin']"/>
<t t-set="kpi_subtitle" t-value="kpi_info['kpi_col2']['col_subtitle']"/>
</t>
</td>
<td class="mobile-w-33" width="196" style=" text-align: center;">
<t t-call="digest.digest_tool_kpi">
<t t-set="kpi_value" t-value="kpi_info['kpi_col3']['value']"/>
<t t-set="kpi_margin" t-value="kpi_info['kpi_col3']['margin']"/>
<t t-set="kpi_subtitle" t-value="kpi_info['kpi_col3']['col_subtitle']"/>
</t>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table t-if="preferences" bgcolor="#ffffff" cellspacing="0" cellpadding="0" width="650" align="center" border="0" style="border-left: 1px solid #eeeeee; border-right: 1px solid #eeeeee; width: 100%; max-width: 650px; padding:30px 30px">
<tr>
<td bgcolor="#fafafa" width="100%" style="padding-top: 20px; padding-bottom: 20px;" align="center">
<p t-foreach="preferences" t-as="preference" class="font-12" style="font-size: 15px; color: #6b6d70">
<t t-raw="preference"/>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table t-if="display_mobile_banner" cellspacing="0" cellpadding="0" align="center" border="0" bgcolor="#eeeeee" style="width:100%; font-family: Arial,Helvetica,Verdana,sans-serif;">
<tr>
<td align="center" valign="top">
<table bgcolor="#ffffff" cellspacing="0" cellpadding="0" width="650" align="center" border="0" style="border: 1px solid #eeeeee; width: 100%; max-width: 650px; padding:30px 30px">
<tr valign="top">
<td>
<t t-call="digest.digest_section_mobile"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" align="center" border="0" bgcolor="#eeeeee" style="width:100%; font-family: Arial,Helvetica,Verdana,sans-serif;">
<tr>
<td align="center" valign="top">
<table bgcolor="#eeeeee" cellspacing="0" cellpadding="0" width="650" align="center" border="0" style="margin-top:30px;font-size: 15px; text-align:center; width: 100%; max-width: 650px;">
<tr>
<td style="color:#8F8F8F;font-weight:bold;font-size: 20px; line-height: 30px;" t-esc="company.name"/>
</tr>
<tr>
<td style="color:#8F8F8F;font-size: 12px; line-height: 30px;">Powered by <a href="https://www.odoo.com" target="_blank" style="color:#875A7B">Odoo</a>.</td>
</tr>
<tr>
<td height="30"> </td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</template>
<!-- DIGEST PARTS -->
<!-- MOBILE BANNER -->
<template id="digest_section_mobile">
<table cellspacing="0" cellpadding="0" border="0" width="580" align="center" style="width:100%; max-width:580px;">
<tr>
<td valign="top" width="168">
<img src="https://www.odoo.com/web/image/24717933/odoo-mobile.png" alt="Odoo Mobile" width="168"/>
</td>
<td valign="top">
<p class="font-16" style="color:#2d2a26;font-size: 18px;line-height: 23px; margin-top: 20px">Run your business from anywhere with <br class="mobile-hide" /><b>Odoo Mobile</b>.</p>
<a href="https://play.google.com/store/apps/details?id=com.odoo.mobile" target="_blank"><img src="https://www.odoo.com/digest/static/src/img/google_play.png" style="display:inline-block;height: 40px; margin-bottom: 5px"/></a>
<span class="mobile-hide"> </span>
<a href="https://itunes.apple.com/us/app/odoo/id1272543640" target="_blank"><img src="https://www.odoo.com/digest/static/src/img/app_store.png" style="display:inline-block;height: 40px; margin-bottom: 5px"/></a>
</td>
</tr>
</table>
</template>
<!-- DIGEST TOOLS -->
<!-- KPI DISPLAY -->
<template id="digest_tool_kpi">
<span class="font-25" style="color:#282f33;font-size: 35px; font-weight: bold; text-decoration: none; line-height: 36px;">
<t t-esc="kpi_value"/>
</span><br/>
<span style="color:#888888;display: inline-block; font-size: 12px; line-height: 18px; text-transform: uppercase;">
<t t-esc="kpi_subtitle"/>
</span>
<t t-if="kpi_margin != 0.0">
<t t-if="kpi_margin &gt; 0.0">
<div style="background-color:#d5f1e2; border: 1px solid #c4ecd7; margin: 10px auto;width: 67px; line-height:27px; text-decoration: none; color: #17613a; border-radius: 5px; font-size:13px;">
▲ <t t-esc="'%.2f' % kpi_margin"/>
</div>
</t>
<t t-elif="kpi_margin &lt; 0.0">
<div style="background-color:#f7dddc; border: 1px solid #f4cfce; margin: 10px auto;width: 67px; line-height:27px; text-decoration: none; color: #712b29; border-radius: 5px; font-size:13px;">
▼ <t t-esc="'%.2f' % kpi_margin"/>
</div>
</t>
</t>
</template>
</data></odoo>