[IMP] account, l10n_be_invoice: make templates more modern and updated with Odoo guidelines

In this commit we improve templates used in account and l10n_be. Purpose of this
commit is to have templates that embed or use standard Odoo email layouts to
make them look modern and have a common style across all emails.

Main guidelines

 * better use of div / p / br to try to lessen layout issues, especially
   when updating templates using the editor;
 * correctly sequence the templates fields definition;
 * correctly set templates values notably auto_delete and user_signature
   fields to avoid confusion;
 * correctly layout the email content using light notification email. It
   can either propagate the layout choice through various send mail methods
   or directly embed the styling in the templates for more technical or
   complex templates;
 * use email_formatted computed field when possible to avoid having hand-made
   from / to addresses;
 * fix various typos and improve subjects when necessary;

Content of emails is not necessarily updated as the purpose of this task is
about styling, not content itself.

This commit is linked to task ID 1843395 and 1843376 (and 1868112) and to
PR #25294 and #25349 (and #25889).

Co-Authored-By: Mitali Patel <mpa@odoo.com>
This commit is contained in:
Pratima Gupta
2018-07-24 15:33:22 +02:00
committed by Thibault Delavallée
co-authored by Mitali Patel
parent 022a1660b4
commit 0d83edc9b0
2 changed files with 53 additions and 54 deletions
+22 -13
View File
@@ -4,24 +4,32 @@
<!--Email template -->
<record id="mail_template_data_payment_receipt" model="mail.template">
<field name="name">Payment Receipt - Send by Email</field>
<field name="name">Payment Receipt: Send by email</field>
<field name="model_id" ref="account.model_account_payment"/>
<field name="subject">${object.company_id.name} Payment Receipt (Ref ${object.name or 'n/a' })</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="model_id" ref="account.model_account_payment"/>
<field name="auto_delete" eval="True"/>
<field name="body_html" type="xml">
<div style="margin: 0px; padding: 0px;">
<p style="margin: 0px; padding: 0px; font-size: 13px;">
Dear ${object.partner_id.name}<br/><br/>
Thank you for your payment.
Here is your payment receipt <strong>${(object.name or '').replace('/','-')}</strong> amounting
to <strong>${format_amount(object.amount, object.currency_id)}</strong> from ${object.company_id.name}.
<br /><br />
Do not hesitate to contact us if you have any question.
<br/><br/>
Best regards,<br/>
% if user and user.signature:
${user.signature | safe}
% endif
</p>
</div>
</field>
<field name="report_template" ref="account.action_report_payment_receipt"/>
<field name="report_name">${(object.name or '').replace('/','-')}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html" type="xml">
<p>Dear ${object.partner_id.name},</p>
<p>Thank you for your payment.<br />Here is your payment receipt <strong>${(object.name or '').replace('/','-')}</strong> amounting to <strong>${format_amount(object.amount, object.currency_id)}</strong> from ${object.company_id.name}.</p>
<p>If you have any questions, please do not hesitate to contact us.</p>
<p>Best regards,
% if user and user.signature:
${user.signature | safe}
% endif
</p>
</field>
<field name="auto_delete" eval="True"/>
<field name="user_signature" eval="False"/>
</record>
<act_window name="Send Receipt By Email"
@@ -39,6 +47,7 @@ ${user.signature | safe}
'default_res_id': active_id,
'default_template_id': ref('account.mail_template_data_payment_receipt'),
'force_email': True,
'custom_layout': 'mail.mail_notification_light',
}"
/>
</data>
@@ -2,47 +2,37 @@
<odoo>
<data noupdate="1">
<record id="account.email_template_edi_invoice" model="mail.template">
<field name="body_html"><![CDATA[
<p>Dear ${object.partner_id.name}
% set access_action = object.with_context(force_website=True).get_access_action()
% set is_online = access_action and access_action['type'] == 'ir.actions.act_url'
% set access_url = is_online and object.get_mail_url() or '/report/pdf/account.report_invoice/' + str(object.id)
% if object.partner_id.parent_id:
(<i>${object.partner_id.parent_id.name}</i>)
% endif
,</p>
<p>Here is your
% if object.number:
invoice <strong>${object.number}</strong>
% else:
pro-forma invoice
% endif
% if object.origin:
(with reference: ${object.origin} )
% endif
amounting in <strong>${format_amount(object.amount_total, object.currency_id)}</strong>
from ${object.company_id.name}.
</p>
% if is_online:
<br/><br/>
<center>
<a href="${access_url}" style="background-color: #1abc9c; padding: 20px; text-decoration: none; color: #fff; border-radius: 5px; font-size: 16px;" class="o_default_snippet_text">View Invoice</a>
</center>
% endif
<br/><br/>
% if object.reference_type=='bba' and object.reference:
<p>Please use the following communication for your payment : <b>${object.reference}</b></p>
% endif
<p>Please remit payment at your earliest convenience.</p>
<p>Thank you,</p>
% if object.user_id and object.user_id.signature:
${object.user_id.signature | safe}
% endif
]]></field>
<field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
<p style="margin: 0px; padding: 0px; font-size: 13px;">
Dear ${object.partner_id.name}
% if object.partner_id.parent_id:
(${object.partner_id.parent_id.name})
% endif
<br /><br />
Here is, in attachment, your
% if object.number:
invoice <strong>${object.number}</strong>
% else:
invoice
%endif
% if object.origin:
(with reference: ${object.origin} )
% endif
amounting in <strong>${format_amount(object.amount_total, object.currency_id)}</strong>
from ${object.company_id.name}.
% if object.state=='paid':
This invoice is already paid.
% else:
Please remit payment at your earliest convenience.
% if object.reference_type == 'bba' and object.reference:
Please use the following communication for your payment: <strong>${object.reference}</strong>.
% endif
<br /><br />
Do not hesitate to contact us if you have any question.
</p>
</div>
</field>
</record>
</data>
</odoo>