[MOV][IMP] website_{profile/slides}: reorganize qweb / jinja templates used for mailing
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
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
'gamification'
|
||||
],
|
||||
'data': [
|
||||
'data/profile_data.xml',
|
||||
'data/mail_template_data.xml',
|
||||
'views/gamification_badge_views.xml',
|
||||
'views/website_profile.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
||||
@@ -48,7 +48,8 @@ Featuring
|
||||
'wizard/slide_channel_invite_views.xml',
|
||||
'data/gamification_data.xml',
|
||||
'data/mail_data.xml',
|
||||
'data/mail_activity_data.xml',
|
||||
'data/mail_template_data.xml',
|
||||
'data/mail_templates.xml',
|
||||
'data/slide_data.xml',
|
||||
'data/website_data.xml',
|
||||
],
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="mail_activity_data_access_request" model="mail.activity.type">
|
||||
<field name="name">Access Request</field>
|
||||
<field name="icon">fa-check-circle</field>
|
||||
<field name="sequence">50</field>
|
||||
<field name="res_model_id" ref="website_slides.model_slide_channel"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -1,196 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="slide_template_published" model="mail.template">
|
||||
<field name="name">Slide Published</field>
|
||||
<field name="model_id" ref="model_slide_slide"/>
|
||||
<field name="subject">New ${object.slide_type} published on ${object.channel_id.name}</field>
|
||||
<field name="body_html" type="html">
|
||||
<div style="margin: 0px; padding: 0px;">
|
||||
<p style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
Hello<br/><br/>
|
||||
There is something new in the course <strong>${object.channel_id.name}</strong> you are following:<br/><br/>
|
||||
<center><strong>${object.name}</strong></center>
|
||||
% if object.image_1024
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="${object.website_url}">
|
||||
<img alt="${object.name}" src="${ctx['base_url']}/web/image/slide.slide/${object.id}/image_1024" style="height:auto; width:150px; margin: 16px;"/>
|
||||
</a>
|
||||
</div>
|
||||
% endif
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="${object.website_url}"
|
||||
style="background-color: #875a7b; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px;">View content</a>
|
||||
</div>
|
||||
Enjoy this exclusive content!
|
||||
% if user.signature
|
||||
<br />
|
||||
${user.signature | safe}
|
||||
% endif
|
||||
</p>
|
||||
</div>
|
||||
</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
</record>
|
||||
<odoo><data noupdate="1">
|
||||
<!-- Channel subtypes -->
|
||||
<record id="mt_channel_slide_published" model="mail.message.subtype">
|
||||
<field name="name">Presentation Published</field>
|
||||
<field name="res_model">slide.channel</field>
|
||||
<field name="default" eval="True"/>
|
||||
<field name="description">Presentation Published</field>
|
||||
</record>
|
||||
|
||||
<record id="slide_template_shared" model="mail.template">
|
||||
<field name="name">Slide Shared</field>
|
||||
<field name="model_id" ref="model_slide_slide"/>
|
||||
<field name="subject">${user.name} shared a ${object.slide_type} with you!</field>
|
||||
<field name="email_from">${user.email_formatted | safe}</field>
|
||||
<field name="email_to">${ctx.get('email', '')}</field>
|
||||
<field name="body_html" type="html">
|
||||
<div style="margin: 0px; padding: 0px;">
|
||||
<p style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
Hello<br/><br/>
|
||||
${user.name} shared the ${object.slide_type} <strong>${object.name}</strong> with you!
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="${(object.website_url + '?fullscreen=1') if ctx['fullscreen'] else object.website_url | safe}">
|
||||
<img alt="${object.name}" src="${ctx['base_url']}/web/image/slide.slide/${object.id}/image_1024" style="height:auto; width:150px; margin: 16px;"/>
|
||||
</a>
|
||||
</div>
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="${(object.website_url + '?fullscreen=1') if ctx['fullscreen'] else object.website_url | safe}"
|
||||
style="background-color: #875a7b; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px;">View <strong>${object.name}</strong></a>
|
||||
</div>
|
||||
% if user.signature
|
||||
<br />
|
||||
${user.signature | safe}
|
||||
% endif
|
||||
</p>
|
||||
</div>
|
||||
</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- Completed Channel Message -->
|
||||
<record id="mail_template_channel_completed" model="mail.template">
|
||||
<field name="name">Completed Course</field>
|
||||
<field name="model_id" ref="model_slide_channel_partner"/>
|
||||
<field name="subject">Congratulation! You completed ${object.channel_id.name}</field>
|
||||
<field name="email_from">${(object.channel_id.user_id.email_formatted or object.channel_id.user_id.company_id.catchall_formatted) | safe}</field>
|
||||
<field name="partner_to">${object.partner_id.id}</field>
|
||||
<field name="body_html" type="html">
|
||||
<div style="margin: 0px; padding: 0px;">
|
||||
<div style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
<p style="margin: 0px;">Hello ${object.partner_id.name},</p><br/>
|
||||
<p><b>Congratulations!</b></p>
|
||||
<p>You've completed the course <b>${object.channel_id.name}</b></p>
|
||||
<p>Check out the other available courses.</p><br/>
|
||||
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="/slides/all" style="background-color: #875a7b; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px;">
|
||||
Explore courses
|
||||
</a>
|
||||
</div>
|
||||
Enjoy this exclusive content!
|
||||
% if object.channel_id.user_id.signature
|
||||
<br />
|
||||
${object.channel_id.user_id.signature | safe}
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
<field name="lang">${object.partner_id.lang}</field>
|
||||
</record>
|
||||
|
||||
<!-- Channel subtypes -->
|
||||
<record id="mt_channel_slide_published" model="mail.message.subtype">
|
||||
<field name="name">Presentation Published</field>
|
||||
<field name="res_model">slide.channel</field>
|
||||
<field name="default" eval="True"/>
|
||||
<field name="description">Presentation Published</field>
|
||||
</record>
|
||||
|
||||
<!-- Slide channel invite feature -->
|
||||
<record id="mail_template_slide_channel_invite" model="mail.template">
|
||||
<field name="name">Channel: Invite by email</field>
|
||||
<field name="model_id" ref="model_slide_channel_partner" />
|
||||
<field name="subject">You have been invited to join ${object.channel_id.name}</field>
|
||||
<field name="use_default_to" eval="True"/>
|
||||
<field name="body_html" type="html">
|
||||
<div style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
<p style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
Hello<br/><br/>
|
||||
You have been invited to join a new course: ${object.channel_id.name}.
|
||||
</p>
|
||||
</div>
|
||||
</field>
|
||||
<field name="lang">${object.partner_id.lang}</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- QWeb templates -->
|
||||
<!-- Note: mail_notification_channel_invite: record should be a slide.channel.partner record -->
|
||||
<template id="mail_notification_channel_invite">
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;"><tr><td align="center">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="590" style="padding: 24px; background-color: white; color: #454748; border-collapse:separate;">
|
||||
<tbody>
|
||||
<!-- HEADER -->
|
||||
<tr>
|
||||
<td align="center" style="min-width: 590px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color: white; padding: 0; border-collapse:separate;">
|
||||
<tr><td valign="middle">
|
||||
<span style="font-size: 10px;">Your <t t-esc="model_description or 'document'"/></span><br/>
|
||||
<span style="font-size: 20px; font-weight: bold;">
|
||||
<t t-esc="message.record_name and message.record_name.replace('/','-') or ''"/>
|
||||
</span>
|
||||
</td><td valign="middle" align="right">
|
||||
<img t-att-src="'/logo.png?company=%s' % (company.id or 0)" style="padding: 0px; margin: 0px; height: 48px;" t-att-alt="'%s' % company.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:4px 0px 32px 0px;"/>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- CONTENT -->
|
||||
<tr>
|
||||
<td style="min-width: 590px;">
|
||||
<t t-raw="message.body"/>
|
||||
<div style="margin: 32px 0px 32px 0px; text-align: center;">
|
||||
<a t-att-href="record.channel_id.website_url"
|
||||
style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">
|
||||
Click here to start the course
|
||||
</a>
|
||||
</div>
|
||||
<div style="margin: 0px; padding: 0px; font-size:13px;">
|
||||
Enjoy this exclusive content !
|
||||
</div>
|
||||
<div>&nbsp;</div>
|
||||
<div t-if="signature" style="font-size: 13px;">
|
||||
<div t-raw="signature"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- FOOTER -->
|
||||
<tr>
|
||||
<td align="center" style="min-width: 590px; padding: 0 8px 0 8px; font-size:11px;">
|
||||
<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 4px 0px;"/>
|
||||
<b t-esc="company.name"/><br/>
|
||||
<div style="color: #999999;">
|
||||
<t t-esc="company.phone"/>
|
||||
<t t-if="company.email"> |
|
||||
<a t-att-href="'mailto:%s' % company.email" style="text-decoration:none; color: #999999;"><t t-esc="company.email"/></a>
|
||||
</t>
|
||||
<t t-if="company.website"> |
|
||||
<a t-att-href="'%s' % company.website" style="text-decoration:none; color: #999999;">
|
||||
<t t-esc="company.website"/>
|
||||
</a>
|
||||
</t>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td></tr>
|
||||
<!-- POWERED BY -->
|
||||
<tr><td align="center" style="min-width: 590px;">
|
||||
Powered by <a target="_blank" href="https://www.odoo.com?utm_source=db&utm_medium=email" style="color: #875A7B;">Odoo</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
<record id="mail_activity_data_access_request" model="mail.activity.type">
|
||||
<field name="name">Access Request</field>
|
||||
<field name="icon">fa-check-circle</field>
|
||||
<field name="sequence">50</field>
|
||||
<field name="res_model_id" ref="website_slides.model_slide_channel"/>
|
||||
</record>
|
||||
</data></odoo>
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="slide_template_published" model="mail.template">
|
||||
<field name="name">Slide Published</field>
|
||||
<field name="model_id" ref="model_slide_slide"/>
|
||||
<field name="subject">New ${object.slide_type} published on ${object.channel_id.name}</field>
|
||||
<field name="body_html" type="html">
|
||||
<div style="margin: 0px; padding: 0px;">
|
||||
<p style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
Hello<br/><br/>
|
||||
There is something new in the course <strong>${object.channel_id.name}</strong> you are following:<br/><br/>
|
||||
<center><strong>${object.name}</strong></center>
|
||||
% if object.image_1024
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="${object.website_url}">
|
||||
<img alt="${object.name}" src="${ctx['base_url']}/web/image/slide.slide/${object.id}/image_1024" style="height:auto; width:150px; margin: 16px;"/>
|
||||
</a>
|
||||
</div>
|
||||
% endif
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="${object.website_url}"
|
||||
style="background-color: #875a7b; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px;">View content</a>
|
||||
</div>
|
||||
Enjoy this exclusive content!
|
||||
% if user.signature
|
||||
<br />
|
||||
${user.signature | safe}
|
||||
% endif
|
||||
</p>
|
||||
</div>
|
||||
</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record id="slide_template_shared" model="mail.template">
|
||||
<field name="name">Slide Shared</field>
|
||||
<field name="model_id" ref="model_slide_slide"/>
|
||||
<field name="subject">${user.name} shared a ${object.slide_type} with you!</field>
|
||||
<field name="email_from">${user.email_formatted | safe}</field>
|
||||
<field name="email_to">${ctx.get('email', '')}</field>
|
||||
<field name="body_html" type="html">
|
||||
<div style="margin: 0px; padding: 0px;">
|
||||
<p style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
Hello<br/><br/>
|
||||
${user.name} shared the ${object.slide_type} <strong>${object.name}</strong> with you!
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="${(object.website_url + '?fullscreen=1') if ctx['fullscreen'] else object.website_url | safe}">
|
||||
<img alt="${object.name}" src="${ctx['base_url']}/web/image/slide.slide/${object.id}/image_1024" style="height:auto; width:150px; margin: 16px;"/>
|
||||
</a>
|
||||
</div>
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="${(object.website_url + '?fullscreen=1') if ctx['fullscreen'] else object.website_url | safe}"
|
||||
style="background-color: #875a7b; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px;">View <strong>${object.name}</strong></a>
|
||||
</div>
|
||||
% if user.signature
|
||||
<br />
|
||||
${user.signature | safe}
|
||||
% endif
|
||||
</p>
|
||||
</div>
|
||||
</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- Completed Channel Message -->
|
||||
<record id="mail_template_channel_completed" model="mail.template">
|
||||
<field name="name">Completed Course</field>
|
||||
<field name="model_id" ref="model_slide_channel_partner"/>
|
||||
<field name="subject">Congratulation! You completed ${object.channel_id.name}</field>
|
||||
<field name="email_from">${(object.channel_id.user_id.email_formatted or object.channel_id.user_id.company_id.catchall_formatted) | safe}</field>
|
||||
<field name="partner_to">${object.partner_id.id}</field>
|
||||
<field name="body_html" type="html">
|
||||
<div style="margin: 0px; padding: 0px;">
|
||||
<div style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
<p style="margin: 0px;">Hello ${object.partner_id.name},</p><br/>
|
||||
<p><b>Congratulations!</b></p>
|
||||
<p>You've completed the course <b>${object.channel_id.name}</b></p>
|
||||
<p>Check out the other available courses.</p><br/>
|
||||
|
||||
<div style="margin: 16px 8px 16px 8px; text-align: center;">
|
||||
<a href="/slides/all" style="background-color: #875a7b; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px;">
|
||||
Explore courses
|
||||
</a>
|
||||
</div>
|
||||
Enjoy this exclusive content!
|
||||
% if object.channel_id.user_id.signature
|
||||
<br />
|
||||
${object.channel_id.user_id.signature | safe}
|
||||
% endif
|
||||
</div>
|
||||
</div>
|
||||
</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
<field name="lang">${object.partner_id.lang}</field>
|
||||
</record>
|
||||
|
||||
<!-- Slide channel invite feature -->
|
||||
<record id="mail_template_slide_channel_invite" model="mail.template">
|
||||
<field name="name">Channel: Invite by email</field>
|
||||
<field name="model_id" ref="model_slide_channel_partner" />
|
||||
<field name="subject">You have been invited to join ${object.channel_id.name}</field>
|
||||
<field name="use_default_to" eval="True"/>
|
||||
<field name="body_html" type="html">
|
||||
<div style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
<p style="margin: 0px; padding: 0px; font-size: 13px;">
|
||||
Hello<br/><br/>
|
||||
You have been invited to join a new course: ${object.channel_id.name}.
|
||||
</p>
|
||||
</div>
|
||||
</field>
|
||||
<field name="lang">${object.partner_id.lang}</field>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo><data noupdate="1">
|
||||
<!-- QWeb templates -->
|
||||
<!-- Note: mail_notification_channel_invite: record should be a slide.channel.partner record -->
|
||||
<template id="mail_notification_channel_invite">
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding-top: 16px; background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;"><tr><td align="center">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="590" style="padding: 24px; background-color: white; color: #454748; border-collapse:separate;">
|
||||
<tbody>
|
||||
<!-- HEADER -->
|
||||
<tr>
|
||||
<td align="center" style="min-width: 590px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="background-color: white; padding: 0; border-collapse:separate;">
|
||||
<tr><td valign="middle">
|
||||
<span style="font-size: 10px;">Your <t t-esc="model_description or 'document'"/></span><br/>
|
||||
<span style="font-size: 20px; font-weight: bold;">
|
||||
<t t-esc="message.record_name and message.record_name.replace('/','-') or ''"/>
|
||||
</span>
|
||||
</td><td valign="middle" align="right">
|
||||
<img t-att-src="'/logo.png?company=%s' % (company.id or 0)" style="padding: 0px; margin: 0px; height: 48px;" t-att-alt="'%s' % company.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:4px 0px 32px 0px;"/>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- CONTENT -->
|
||||
<tr>
|
||||
<td style="min-width: 590px;">
|
||||
<t t-raw="message.body"/>
|
||||
<div style="margin: 32px 0px 32px 0px; text-align: center;">
|
||||
<a t-att-href="record.channel_id.website_url"
|
||||
style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">
|
||||
Click here to start the course
|
||||
</a>
|
||||
</div>
|
||||
<div style="margin: 0px; padding: 0px; font-size:13px;">
|
||||
Enjoy this exclusive content !
|
||||
</div>
|
||||
<div>&nbsp;</div>
|
||||
<div t-if="signature" style="font-size: 13px;">
|
||||
<div t-raw="signature"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- FOOTER -->
|
||||
<tr>
|
||||
<td align="center" style="min-width: 590px; padding: 0 8px 0 8px; font-size:11px;">
|
||||
<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 4px 0px;"/>
|
||||
<b t-esc="company.name"/><br/>
|
||||
<div style="color: #999999;">
|
||||
<t t-esc="company.phone"/>
|
||||
<t t-if="company.email"> |
|
||||
<a t-att-href="'mailto:%s' % company.email" style="text-decoration:none; color: #999999;"><t t-esc="company.email"/></a>
|
||||
</t>
|
||||
<t t-if="company.website"> |
|
||||
<a t-att-href="'%s' % company.website" style="text-decoration:none; color: #999999;">
|
||||
<t t-esc="company.website"/>
|
||||
</a>
|
||||
</t>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td></tr>
|
||||
<!-- POWERED BY -->
|
||||
<tr><td align="center" style="min-width: 590px;">
|
||||
Powered by <a target="_blank" href="https://www.odoo.com?utm_source=db&utm_medium=email" style="color: #875A7B;">Odoo</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
</template>
|
||||
</data></odoo>
|
||||
Reference in New Issue
Block a user