diff options
| author | Thibault Delavallée <tde@odoo.com> | 2017-08-22 14:38:23 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2017-08-25 11:41:41 +0200 |
| commit | 4e11d2fcb0e3e6b830bbef82f1d0de383ef8abae (patch) | |
| tree | 12c9b2b4ce2db69d8fab7fc4cb0d7a838e6ad2fb /addons/account | |
| parent | ac001c8f98adcaaa01dd1fc21fdc090d48ffeccf (diff) | |
[CLN] account: perform some guidelining and cleaning
* rename some files according to guidelines;
* clean template name to clean their ordering and ease template browsing;
* use html type for mail templates body instead of cdata;
* clean html for mail templates introduced at 96da10de6cc20486b3e37fd4c6c88eb61cbb919c;
No horse has been harmed and no functional change performed.
Diffstat (limited to 'addons/account')
| -rw-r--r-- | addons/account/__manifest__.py | 2 | ||||
| -rw-r--r-- | addons/account/data/email_template_data_invoice.xml | 145 | ||||
| -rw-r--r-- | addons/account/data/mail_template_data.xml | 140 |
3 files changed, 141 insertions, 146 deletions
diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py index 8c44a113c8a..a87fc2360f7 100644 --- a/addons/account/__manifest__.py +++ b/addons/account/__manifest__.py @@ -24,7 +24,7 @@ Core mechanisms for the accounting modules. To display the menuitems, install th 'wizard/account_move_reversal_view.xml', 'views/account_view.xml', 'views/account_report.xml', - 'data/email_template_data_invoice.xml', + 'data/mail_template_data.xml', 'wizard/account_invoice_refund_view.xml', 'wizard/account_validate_move_view.xml', 'wizard/account_invoice_state_view.xml', diff --git a/addons/account/data/email_template_data_invoice.xml b/addons/account/data/email_template_data_invoice.xml deleted file mode 100644 index b0e8dd1d175..00000000000 --- a/addons/account/data/email_template_data_invoice.xml +++ /dev/null @@ -1,145 +0,0 @@ -<?xml version="1.0" ?> -<odoo> - - <!-- Mail template are declared in a NOUPDATE block - so users can freely customize/delete them --> - <data noupdate="1"> - <!--Email template --> - <record id="email_template_edi_invoice" model="mail.template"> - <field name="name">Invoice - Send by Email</field> - <field name="email_from">${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field> - <field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})</field> - <field name="partner_to">${object.partner_id.id}</field> - <field name="model_id" ref="account.model_account_invoice"/> - <field name="auto_delete" eval="True"/> - <field name="report_template" ref="account_invoices"/> - <field name="report_name">Invoice_${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field> - <field name="lang">${object.partner_id.lang}</field> - <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, 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>${object.amount_total} ${object.currency_id.name}</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.state=='paid': - <p>This invoice is already paid.</p> -% else: - <p>Please remit payment at your earliest convenience.</p> -% endif - -<p>Thank you,</p> -<p style="color:#888888"> -% if object.user_id and object.user_id.signature: - ${object.user_id.signature | safe} -% endif -</p> -]]></field> - </record> - - <!--Default Notification Email template for invoices--> - <record id="account.mail_template_data_notification_email_account_invoice" model="mail.template"> - <field name="name">Invoice Notification Email</field> - <field name="subject">${object.subject}</field> - <field name="model_id" ref="mail.model_mail_message"/> - <field name="auto_delete" eval="True"/> - <field name="body_html"><![CDATA[<html> - <head></head> - % set record = ctx.get('record') - % set company = record and record.company_id or user.company_id - <body style="margin: 0; padding: 0;"> - <table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed" summary="o_mail_notification"> - <tbody> - - <!-- HEADER --> - <tr> - <td align="center" style="min-width: 590px;"> - <table width="590" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> - <tr> - <td valign="middle"> - <span style="font-size:20px; color:white; font-weight: bold;"> - Invoice ${object.record_name} - </span> - </td> - <td valign="middle" align="right"> - <img src="/logo.png?company=${company.id}" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${company.name}"> - </td> - </tr> - </table> - </td> - </tr> - - <!-- CONTENT --> - <tr> - <td align="center" style="min-width: 590px;"> - <table width="590" border="0" cellpadding="0" bgcolor="#ffffff" style="min-width: 590px; background-color: rgb(255, 255, 255); padding: 20px;"> - <tbody> - <td valign="top" style="font-family:Arial,Helvetica,sans-serif; color: #555; font-size: 14px;"> - ${object.body | safe} - </td> - </tbody> - </table> - </td> - </tr> - - <!-- FOOTER --> - <tr> - <td align="center" style="min-width: 590px;"> - <table width="590" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> - <tr> - <td valign="middle" align="left" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"> - ${company.name}<br/> - ${company.phone or ''} - </td> - <td valign="middle" align="right" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"> - % if company.email: - <a href="mailto:${company.email}" style="text-decoration:none; color: white;">${company.email}</a><br/> - % endif - % if company.website: - <a href="${company.website}" style="text-decoration:none; color: white;"> - ${company.website} - </a> - % endif - </td> - </tr> - </table> - </td> - </tr> - <tr> - <td align="center"> - Powered by <a target="_blank" href="https://www.odoo.com">Odoo</a>. - </td> - </tr> - </tbody> - </table> - </body> - </html> - ]]></field> - </record> - - </data> -</odoo> diff --git a/addons/account/data/mail_template_data.xml b/addons/account/data/mail_template_data.xml new file mode 100644 index 00000000000..266ac35855b --- /dev/null +++ b/addons/account/data/mail_template_data.xml @@ -0,0 +1,140 @@ +<?xml version="1.0" ?> +<odoo> + + <!-- Mail template are declared in a NOUPDATE block + so users can freely customize/delete them --> + <data noupdate="1"> + <!--Email template --> + <record id="email_template_edi_invoice" model="mail.template"> + <field name="name">Account: Invoice email</field> + <field name="email_from">${(object.user_id.email and '%s <%s>' % (object.user_id.name, object.user_id.email) or '')|safe}</field> + <field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})</field> + <field name="partner_to">${object.partner_id.id}</field> + <field name="model_id" ref="account.model_account_invoice"/> + <field name="auto_delete" eval="True"/> + <field name="report_template" ref="account_invoices"/> + <field name="report_name">Invoice_${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field> + <field name="lang">${object.partner_id.lang}</field> + <field name="body_html" type="html"> +<div> +<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, 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>${object.amount_total} ${object.currency_id.name}</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.state=='paid': + <p>This invoice is already paid.</p> +% else: + <p>Please remit payment at your earliest convenience.</p> +% endif + +<p>Thank you,</p> +<p style="color:#888888"> +% if object.user_id and object.user_id.signature: + ${object.user_id.signature | safe} +% endif +</p> +</div></field> + </record> + + <!--Default Notification Email template for invoices--> + <record id="account.mail_template_data_notification_email_account_invoice" model="mail.template"> + <field name="name">Account: Invoice notification header</field> + <field name="subject">${object.subject}</field> + <field name="model_id" ref="mail.model_mail_message"/> + <field name="auto_delete" eval="True"/> + <field name="body_html" type="html"> +<div> +% set record = ctx.get('record') +% set company = record and record.company_id or user.company_id +<table border="0" width="100%" cellpadding="0" bgcolor="#ededed" style="padding: 20px; background-color: #ededed" summary="o_mail_notification"> +<tbody> + <!-- HEADER --> + <tr> + <td align="center" style="min-width: 590px;"> + <table width="590" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> + <tr> + <td valign="middle"> + <span style="font-size:20px; color:white; font-weight: bold;"> + Invoice ${object.record_name} + </span> + </td> + <td valign="middle" align="right"> + <img src="/logo.png?company=${company.id}" style="padding: 0px; margin: 0px; height: auto; width: 80px;" alt="${company.name}"/> + </td> + </tr> + </table> + </td> + </tr> + <!-- CONTENT --> + <tr> + <td align="center" style="min-width: 590px;"> + <table width="590" border="0" cellpadding="0" bgcolor="#ffffff" style="min-width: 590px; background-color: rgb(255, 255, 255); padding: 20px;"> + <tbody> + <td valign="top" style="font-family:Arial,Helvetica,sans-serif; color: #555; font-size: 14px;"> + ${object.body | safe} + </td> + </tbody> + </table> + </td> + </tr> + <!-- FOOTER --> + <tr> + <td align="center" style="min-width: 590px;"> + <table width="590" border="0" cellpadding="0" bgcolor="#875A7B" style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px;"> + <tr> + <td valign="middle" align="left" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"> + ${company.name}<br/> + ${company.phone or ''} + </td> + <td valign="middle" align="right" style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"> + % if company.email: + <a href="mailto:${company.email}" style="text-decoration:none; color: white;">${company.email}</a><br/> + % endif + % if company.website: + <a href="${company.website}" style="text-decoration:none; color: white;"> + ${company.website} + </a> + % endif + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td align="center"> + Powered by <a target="_blank" href="https://www.odoo.com">Odoo</a>. + </td> + </tr> +</tbody> +</table> +</div></field> + </record> + + </data> +</odoo> |
