PURPOSE
Clean organization of templates in odoo apps: mail.template records in data,
qweb templates (views) used directly in code, notably using post with view.
Purpose is to ease future improvements in posting based on templates.
SPECIFICATIONS
* move those templates in their own file to ease their discovering and
maintenance;
* put them into data (as those are not views even if it contains qweb)
* guidelines are now :
-> Qweb templates should be in data/mail_templates.xml;
-> mail.template records should be in data/mail_template_data.xml;
* put their declaration in no update when not done if template has no
technical code or complex dependency on underlying code;
* move found mail data (mail.message.subtype or mail.activity.type) records
in a mail_data file that should contain only "core" records linked to mail;
LINKS
Task ID-2375767
COM PR odoo/odoo#61814
ENT PR odoo/enterprise#14775
UPG PR odoo/upgrade#1936
384 lines
24 KiB
XML
384 lines
24 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<data noupdate="1">
|
|
<record id="email_template_badge_received" model="mail.template">
|
|
<field name="name">Received Badge</field>
|
|
<field name="subject">New badge ${object.badge_id.name} granted</field>
|
|
<field name="model_id" ref="gamification.model_gamification_badge_user"/>
|
|
<field name="partner_to">${object.user_id.partner_id.id}</field>
|
|
<field name="body_html" type="xml">
|
|
<table border="0" cellpadding="0" style="padding-top: 16px; background-color: #F1F1F1; color: #454748; width: 100%; border-collapse:separate;"><tr><td align="center">
|
|
<table border="0" width="590" cellpadding="0" style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;" summary="o_mail_notification">
|
|
<tbody>
|
|
<!-- HEADER -->
|
|
<tr>
|
|
<td align="center" style="min-width: 590px;">
|
|
<table width="590" border="0" cellpadding="0" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
|
|
<tr><td valign="middle">
|
|
<span style="font-size: 10px;">Your Badge</span><br/>
|
|
<span style="font-size: 20px; font-weight: bold;">
|
|
${object.badge_id.name}
|
|
</span>
|
|
</td><td valign="middle" align="right">
|
|
<img src="/logo.png?company=${object.user_id.company_id.id}" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${object.user_id.company_id.name}"/>
|
|
</td></tr>
|
|
<tr><td colspan="2" style="text-align:center;">
|
|
<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: 16px 0px 16px 0px;"/>
|
|
</td></tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<!-- CONTENT -->
|
|
<tr>
|
|
<td align="center" style="min-width: 590px;">
|
|
<table width="590" border="0" cellpadding="0" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;">
|
|
<tr><td valign="top" style="font-size: 14px;">
|
|
<div>
|
|
Congratulations ${object.user_id.name} !<br/>
|
|
You just received badge <strong>${object.badge_id.name}</strong> !<br/>
|
|
% if object.badge_id.description
|
|
<table cellspacing="0" cellpadding="0" border="0" style="width: 560px; margin-top: 5px;">
|
|
<tbody><tr>
|
|
<td valign="center">
|
|
<img src="/web/image/gamification.badge/${object.badge_id.id}/image_128/80x80" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${user.company_id.name}"/>
|
|
</td>
|
|
<td valign="center">
|
|
<cite>${object.badge_id.description}</cite>
|
|
</td>
|
|
</tr></tbody>
|
|
</table>
|
|
% endif
|
|
<br/>
|
|
% if object.sender_id
|
|
This badge was granted by <strong>${object.sender_id.name}</strong>.
|
|
% endif
|
|
<br/>
|
|
% if object.comment
|
|
${object.comment}
|
|
% endif
|
|
<br/><br/>
|
|
Thank you,
|
|
% if object.sender_id.signature:
|
|
<br />
|
|
${object.sender_id.signature | safe}
|
|
% endif
|
|
</div>
|
|
</td></tr>
|
|
<tr><td style="text-align:center;">
|
|
<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: 16px 0px 16px 0px;"/>
|
|
</td></tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<!-- FOOTER -->
|
|
<tr>
|
|
<td align="center" style="min-width: 590px;">
|
|
<table width="590" border="0" cellpadding="0" style="min-width: 590px; background-color: white; font-size: 12px; padding: 0px 8px 0px 8px; border-collapse:separate;">
|
|
<tr><td valign="middle" align="left">
|
|
${object.user_id.company_id.name}
|
|
</td></tr>
|
|
<tr><td valign="middle" align="left" style="opacity: 0.7;">
|
|
${object.user_id.company_id.phone}
|
|
% if object.user_id.company_id.email
|
|
| <a href="'mailto:%s' % ${object.user_id.company_id.email}" style="text-decoration:none; color: #454748;">${object.user_id.company_id.email}</a>
|
|
% endif
|
|
% if object.user_id.company_id.website
|
|
| <a href="'%s' % ${object.user_id.company_id.website}" style="text-decoration:none; color: #454748;">
|
|
${object.user_id.company_id.website}
|
|
</a>
|
|
% endif
|
|
</td></tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</td></tr>
|
|
<!-- POWERED BY -->
|
|
<tr><td align="center" style="min-width: 590px;">
|
|
<table width="590" border="0" cellpadding="0" style="min-width: 590px; background-color: #F1F1F1; color: #454748; padding: 8px; border-collapse:separate;">
|
|
<tr><td style="text-align: center; font-size: 14px;">
|
|
Powered by <a target="_blank" href="https://www.odoo.com?utm_source=db&utm_medium=gamification" style="color: #875A7B;">Odoo</a>
|
|
</td></tr>
|
|
</table>
|
|
</td></tr>
|
|
</table></field>
|
|
<field name="lang">${object.user_id.lang}</field>
|
|
<field name="auto_delete" eval="True"/>
|
|
</record>
|
|
|
|
<record id="email_template_goal_reminder" model="mail.template">
|
|
<field name="name">Goal: Reminder for Goal Update</field>
|
|
<field name="model_id" ref="gamification.model_gamification_goal"/>
|
|
<field name="partner_to">${object.user_id.partner_id.id}</field>
|
|
<field name="body_html" type="html">
|
|
<div>
|
|
<strong>Reminder ${object.name}</strong><br/>
|
|
You have not updated your progress for the goal ${object.definition_id.name} (currently reached at ${object.completeness}%) for at least ${object.remind_update_delay} days. Do not forget to do it.
|
|
<br/><br/>
|
|
Thank you,
|
|
% if object.challenge_id.manager_id.signature:
|
|
<br />
|
|
${object.challenge_id.manager_id.signature | safe}
|
|
% endif
|
|
</div></field>
|
|
<field name="lang">${object.user_id.lang}</field>
|
|
<field name="auto_delete" eval="True"/>
|
|
</record>
|
|
|
|
<record id="simple_report_template" model="mail.template">
|
|
<field name="name">Challenge: Simple Challenge Report Progress</field>
|
|
<field name="model_id" ref="gamification.model_gamification_challenge"/>
|
|
<field name="body_html" type="html">
|
|
<table cellspacing="0" cellpadding="0" width="100%" style="background-color: #EEE; border-collapse: collapse;">
|
|
<tr>
|
|
<td valign="top" align="center">
|
|
% set record = ctx.get('record')
|
|
% set company = record and record.company_id or user.company_id
|
|
% set challenge_lines = ctx.get('challenge_lines', [])
|
|
<table cellspacing="0" cellpadding="0" width="600" style="margin: 0 auto; width: 570px;">
|
|
<tr><td>
|
|
<table cellspacing="0" cellpadding="0" width="100%">
|
|
<tr>
|
|
<div>
|
|
% if object.visibility_mode == 'ranking':
|
|
<td style="padding:15px;">
|
|
<p style="font-size:20px;color:#666666;" align="center">Leaderboard</p>
|
|
</td>
|
|
% endif
|
|
</div>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="0" cellpadding="0" width="100%" bgcolor="#fff" style="background-color:#fff;">
|
|
<tr><td style="padding: 15px;">
|
|
% if object.visibility_mode == 'personal':
|
|
<span style="color:#666666;font-size:13px;">Here is your current progress in the challenge <strong>${object.name}</strong>.</span>
|
|
<table cellspacing="0" cellpadding="0" width="100%" style="margin-top:20px;">
|
|
<tr>
|
|
<td align="center">
|
|
<div>Personal Performance</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="0" cellpadding="0" width="100%" style="margin-top:30px;color:#666666;">
|
|
<thead>
|
|
<tr style="color:#9A6C8E; font-size:12px;">
|
|
<th align="left" style="padding-bottom: 0px;width:40%;text-align:left;">Goals</th>
|
|
<th style="width:20%;text-align:right;" align="left">Target</th>
|
|
<th style="width:20%;text-align:right;" align="right">Current</th>
|
|
<th style="width:20%;text-align:right;" align="right">Completeness</th>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="5" style="height:1px;background-color:#9A6C8E;"></td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
% for line in challenge_lines:
|
|
<tr style="font-weight:bold;">
|
|
<td style="padding: 20px 0;" align="left">
|
|
${line['name']}
|
|
% if line['suffix'] or line['monetary']:
|
|
(${line['full_suffix']})
|
|
% endif
|
|
</td>
|
|
<td style="padding: 20px 0;" align="right">${"%.2f" % line['target']}
|
|
% if line['suffix']:
|
|
${line['suffix']}
|
|
% endif
|
|
</td>
|
|
<td style="padding: 20px 0;" align="right">${"%.2f" % line['current']}
|
|
% if line['suffix']:
|
|
${line['suffix']}
|
|
% endif
|
|
</td>
|
|
<td style="padding: 20px 0;font-size:25px;color:#9A6C8E;" align="right"><strong>${line['completeness']| int}%</strong></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="5" style="height:1px;background-color:#e3e3e3;"></td>
|
|
</tr>
|
|
% endfor
|
|
</tbody>
|
|
</table>
|
|
% else:
|
|
<span style="color:#A8A8A8;font-size:13px;">
|
|
Challenge: <strong>${object.name}</strong>.
|
|
</span>
|
|
% for line in challenge_lines:
|
|
<!-- Header + Button table -->
|
|
<table cellspacing="0" cellpadding="0" width="100%" style="margin-top:35px;">
|
|
<tr>
|
|
<td width="50%">
|
|
<div>Top Achievers for goal <strong>${line['name']}</strong></div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<!-- Podium -->
|
|
% if len(line['goals']) == 2:
|
|
<table cellspacing="0" cellpadding="0" width="100%" style="margin-top:10px;">
|
|
<tr><td style="padding:0 30px;">
|
|
<table cellspacing="0" cellpadding="0" width="100%" style="table-layout: fixed;">
|
|
<tr>
|
|
% set top_goals = line['goals'][:3]
|
|
% for goal in top_goals:
|
|
<td align="center" style="width:32%;">
|
|
% if loop.index == 1:
|
|
% set extra_div = '<div style="height:40px;"></div>'
|
|
% set heightA = 95
|
|
% set heightB = 75
|
|
% set bgColor = '#b898b0'
|
|
% set fontSize = 50
|
|
% set podiumPosition = '2'
|
|
% elif loop.index == 2:
|
|
% set extra_div = ''
|
|
% set heightA = 55
|
|
% set heightB = 115
|
|
% set bgColor = '#9A6C8E'
|
|
% set fontSize = 85
|
|
% set podiumPosition = '1'
|
|
% elif loop.index == 3:
|
|
% set extra_div = '<div style="height:60px;"></div>'
|
|
% set heightA = 115
|
|
% set heightB = 55
|
|
% set bgColor = '#c8afc1'
|
|
% set fontSize = 35
|
|
% set podiumPosition = '3'
|
|
% endif
|
|
<div style="margin:0 3px 0 3px;height:220px;">
|
|
<div style="height:${heightA}px;">
|
|
${extra_div | safe}
|
|
<div style="height:55px;">
|
|
<img style="margin-bottom:5px;width:50px;height:50px;border-radius:50%;object-fit:cover;" t-att-src="image_data_uri(object.env['res.users'].browse(goal['user_id']).partner_id.image_128)" alt="${goal['name']}"/>
|
|
</div>
|
|
<div align="center" style ="color:${bgColor};height:20px">
|
|
${goal['name']}
|
|
</div>
|
|
</div>
|
|
<div style="background-color:${bgColor | safe};height:${heightB}px;">
|
|
<strong><span style="color:#fff;font-size:${fontSize}px;">${podiumPosition | safe}</span></strong>
|
|
</div>
|
|
<div style="height:30px;">
|
|
${"%.2f" % goal['current']}
|
|
% if line['suffix'] or line['monetary']:
|
|
${line['full_suffix']}
|
|
% endif
|
|
</div>
|
|
</div>
|
|
</td>
|
|
% endfor
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
% endif
|
|
<!-- data table -->
|
|
<table cellspacing="0" cellpadding="0" width="100%" style="margin-bottom:5px">
|
|
<tr>
|
|
<td>
|
|
<table cellspacing="0" cellpadding="0" width="100%" style="margin-top:30px;margin-bottom:5px;color:#666666;">
|
|
<thead>
|
|
<tr style="color:#9A6C8E; font-size:12px;">
|
|
<th style="width:15%;text-align:center;">Rank</th>
|
|
<th style="width:25%;text-align:left;">Name</th>
|
|
<th style="width:30%;text-align:right;">Performance
|
|
% if line['suffix']:
|
|
(${line['suffix']})
|
|
% elif line['monetary']:
|
|
(${company.currency_id.symbol})
|
|
% endif
|
|
</th>
|
|
<th style="width:30%;text-align:right;">Completeness</th>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="5" style="height:1px;background-color:#9A6C8E;"></td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
% for goal in line['goals']:
|
|
<tr>
|
|
% set tdBgColor = '#fff'
|
|
% set tdColor = 'gray'
|
|
% set mutedColor = '#AAAAAA'
|
|
% set tdPercentageColor = '#9A6C8E'
|
|
<td width="15%" align="center" valign="middle" style="background-color:${tdBgColor};padding :5px 0;font-size:20px;">${goal['rank']+1}
|
|
</td>
|
|
<td width="25%" align="left" valign="middle" style="background-color:${tdBgColor};padding :5px 0;font-size:13px;">${goal['name']}</td>
|
|
<td width="30%" align="right" style="background-color:${tdBgColor};padding:5px 0;line-height:1;">${"%.2f" % goal['current']}<br/><span style="font-size:13px;color:${mutedColor};">on ${"%.2f" % line['target']}</span>
|
|
</td>
|
|
<td width="30%" style="color:${tdPercentageColor};background-color:${tdBgColor};padding-right:15px;font-size:22px;" align="right"><strong>${goal['completeness'] | int}%</strong></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="5" style="height:1px;background-color:#DADADA;"></td>
|
|
</tr>
|
|
% endfor
|
|
</tbody>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
% endfor
|
|
% endif
|
|
</td></tr>
|
|
</table>
|
|
</td></tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_template_data_new_rank_reached" model="mail.template">
|
|
<field name="name">User: New rank reached</field>
|
|
<field name="model_id" ref="base.model_res_users"/>
|
|
<field name="subject">New rank: ${object.rank_id.name}</field>
|
|
<field name="email_to"></field>
|
|
<field name="partner_to">${object.partner_id.id}</field>
|
|
<field name="body_html" type="html">
|
|
<div style="background:#F0F0F0;color:#515166;padding:10px 0px;font-family:Arial,Helvetica,sans-serif;font-size:14px;">
|
|
<table style="width:600px;margin:0px auto;background:white;border:1px solid #e1e1e1;">
|
|
<tbody>
|
|
<tr>
|
|
<td style="padding:15px 20px 10px 20px;">
|
|
<p>
|
|
Congratulations
|
|
<span>${object.name or ''}</span>!
|
|
</p>
|
|
<p>
|
|
You just reached a new rank : <strong>${object.rank_id.name}</strong>
|
|
</p>
|
|
% if object.next_rank_id.name
|
|
<p>Continue your work to become a <strong>${object.next_rank_id.name}</strong> !</p>
|
|
% endif
|
|
<div style="margin: 16px 0px 16px 0px;">
|
|
% set gamification_redirection_data = object.get_gamification_redirection_data()
|
|
% for data in gamification_redirection_data
|
|
% set url = data['url']
|
|
% set label = data['label']
|
|
<a href="${url}" style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">${label}</a>
|
|
% endfor
|
|
</div>
|
|
</td>
|
|
<td style="padding:15px 20px 10px 20px;">
|
|
<p style="text-align: center;">
|
|
<img src="/web/image/gamification.karma.rank/${object.rank_id.id}/image_128"/>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
% if user.signature
|
|
<tr>
|
|
<td style="padding:15px 20px 10px 20px;">
|
|
${user.signature | safe}
|
|
</td>
|
|
</tr>
|
|
% endif
|
|
</tbody>
|
|
</table>
|
|
</div></field>
|
|
<field name="lang">${object.lang}</field>
|
|
<field name="auto_delete" eval="True"/>
|
|
</record>
|
|
|
|
</data>
|
|
</odoo>
|