[IMP] account: adapt edi email template
bzr revid: rco@openerp.com-20121213140135-zw9zhmx85ryucn81
This commit is contained in:
parent
0619510955
commit
33463a6bc3
|
@ -22,8 +22,8 @@
|
||||||
<!--Email template -->
|
<!--Email template -->
|
||||||
<record id="email_template_edi_invoice" model="email.template">
|
<record id="email_template_edi_invoice" model="email.template">
|
||||||
<field name="name">Invoice - Send by Email</field>
|
<field name="name">Invoice - Send by Email</field>
|
||||||
<field name="email_from">${object.user_id.email or object.company_id.email or 'noreply@localhost'}</field>
|
<field name="email_from">${object.user_id.email or object.company_id.email or 'noreply@localhost'|safe}</field>
|
||||||
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })</field>
|
<field name="subject">${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})</field>
|
||||||
<field name="email_recipients">${object.partner_id.id}</field>
|
<field name="email_recipients">${object.partner_id.id}</field>
|
||||||
<field name="model_id" ref="account.model_account_invoice"/>
|
<field name="model_id" ref="account.model_account_invoice"/>
|
||||||
<field name="auto_delete" eval="True"/>
|
<field name="auto_delete" eval="True"/>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<field name="body_html"><![CDATA[
|
<field name="body_html"><![CDATA[
|
||||||
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
|
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
|
||||||
|
|
||||||
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
|
<p>Hello ${object.partner_id.name or ''},</p>
|
||||||
|
|
||||||
<p>A new invoice is available for you: </p>
|
<p>A new invoice is available for you: </p>
|
||||||
|
|
||||||
|
@ -46,24 +46,32 @@
|
||||||
Order reference: ${object.origin}<br />
|
Order reference: ${object.origin}<br />
|
||||||
% endif
|
% endif
|
||||||
% if object.user_id:
|
% if object.user_id:
|
||||||
Your contact: <a href="mailto:${object.user_id.email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a>
|
Your contact: <a href="mailto:${object.user_id.email or ''|safe}?subject=Invoice%20${object.number}">${object.user_id.name}</a>
|
||||||
% endif
|
% endif
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
% if object.company_id.paypal_account and object.type in ('out_invoice'):
|
% if object.company_id.paypal_account and object.type in ('out_invoice'):
|
||||||
<%
|
<% set paypal_url = (
|
||||||
comp_name = quote(object.company_id.name)
|
"https://www.paypal.com/cgi-bin/webscr?cmd=_xclick"
|
||||||
inv_number = quote(object.number)
|
"&business=%(paypal_account)s"
|
||||||
paypal_account = quote(object.company_id.paypal_account)
|
"&item_name=%(company_name)s%%20Invoice%%20%(inv)s"
|
||||||
inv_amount = quote(str(object.residual))
|
"&invoice=%(inv)s"
|
||||||
cur_name = quote(object.currency_id.name)
|
"&amount=%(amount)s"
|
||||||
paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s&" \
|
"&currency_code=%(currency)s"
|
||||||
"invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
|
"&button_subtype=services"
|
||||||
(paypal_account,comp_name,inv_number,inv_number,inv_amount,cur_name,cur_name)
|
"&no_note=1"
|
||||||
|
"&bn=OpenERP_Invoice_PayNow_%(currency)s"
|
||||||
|
% {
|
||||||
|
'paypal_account': quote(object.company_id.paypal_account),
|
||||||
|
'company_name': quote(object.company_id.name),
|
||||||
|
'inv': quote(object.number),
|
||||||
|
'amount': quote(str(object.residual)),
|
||||||
|
'currency': quote(object.currency_id.name),
|
||||||
|
})
|
||||||
%>
|
%>
|
||||||
<br/>
|
<br/>
|
||||||
<p>It is also possible to directly pay with Paypal:</p>
|
<p>It is also possible to directly pay with Paypal:</p>
|
||||||
<a style="margin-left: 120px;" href="${paypal_url}">
|
<a style="margin-left: 120px;" href="${paypal_url|safe}">
|
||||||
<img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
|
<img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
|
||||||
</a>
|
</a>
|
||||||
% endif
|
% endif
|
||||||
|
@ -99,7 +107,7 @@
|
||||||
% endif
|
% endif
|
||||||
% if object.company_id.website:
|
% if object.company_id.website:
|
||||||
<div>
|
<div>
|
||||||
Web : <a href="${object.company_id.website}">${object.company_id.website}</a>
|
Web : <a href="${object.company_id.website|safe}">${object.company_id.website|safe}</a>
|
||||||
</div>
|
</div>
|
||||||
%endif
|
%endif
|
||||||
<p></p>
|
<p></p>
|
||||||
|
|
|
@ -53,6 +53,10 @@ try:
|
||||||
trim_blocks=True, # do not output newline after blocks
|
trim_blocks=True, # do not output newline after blocks
|
||||||
autoescape=True, # XML/HTML automatic escaping
|
autoescape=True, # XML/HTML automatic escaping
|
||||||
)
|
)
|
||||||
|
mako_template_env.globals.update({
|
||||||
|
'str': str,
|
||||||
|
'quote': quote,
|
||||||
|
})
|
||||||
except ImportError:
|
except ImportError:
|
||||||
_logger.warning("jinja2 not available, templating features will not work!")
|
_logger.warning("jinja2 not available, templating features will not work!")
|
||||||
|
|
||||||
|
@ -89,7 +93,6 @@ class email_template(osv.osv):
|
||||||
'object': record,
|
'object': record,
|
||||||
'user': user,
|
'user': user,
|
||||||
'ctx': context, # context kw would clash with mako internals
|
'ctx': context, # context kw would clash with mako internals
|
||||||
'quote': quote,
|
|
||||||
}
|
}
|
||||||
result = mako_template_env.from_string(template).render(variables)
|
result = mako_template_env.from_string(template).render(variables)
|
||||||
if result == u"False":
|
if result == u"False":
|
||||||
|
|
Loading…
Reference in New Issue