diff --git a/addons/account/edi/invoice_action_data.xml b/addons/account/edi/invoice_action_data.xml
index c4b0c8103f1..bdb08d66cfe 100644
--- a/addons/account/edi/invoice_action_data.xml
+++ b/addons/account/edi/invoice_action_data.xml
@@ -22,8 +22,8 @@
Invoice - Send by Email
- ${object.user_id.email or object.company_id.email or 'noreply@localhost'}
- ${object.company_id.name} Invoice (Ref ${object.number or 'n/a' })
+ ${object.user_id.email or object.company_id.email or 'noreply@localhost'|safe}
+ ${object.company_id.name} Invoice (Ref ${object.number or 'n/a'})
${object.partner_id.id}
@@ -33,7 +33,7 @@
- Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},
+ Hello ${object.partner_id.name or ''},
A new invoice is available for you:
@@ -46,24 +46,32 @@
Order reference: ${object.origin}
% endif
% if object.user_id:
- Your contact: ${object.user_id.name}
+ Your contact: ${object.user_id.name}
% endif
% if object.company_id.paypal_account and object.type in ('out_invoice'):
- <%
- comp_name = quote(object.company_id.name)
- inv_number = quote(object.number)
- paypal_account = quote(object.company_id.paypal_account)
- inv_amount = quote(str(object.residual))
- cur_name = quote(object.currency_id.name)
- paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s&" \
- "invoice=%s&amount=%s¤cy_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
- (paypal_account,comp_name,inv_number,inv_number,inv_amount,cur_name,cur_name)
+ <% set paypal_url = (
+ "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick"
+ "&business=%(paypal_account)s"
+ "&item_name=%(company_name)s%%20Invoice%%20%(inv)s"
+ "&invoice=%(inv)s"
+ "&amount=%(amount)s"
+ "¤cy_code=%(currency)s"
+ "&button_subtype=services"
+ "&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),
+ })
%>
It is also possible to directly pay with Paypal:
-
+
% endif
@@ -99,7 +107,7 @@
% endif
% if object.company_id.website:
%endif
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 826b82186e4..e4cbc20f8f6 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -53,6 +53,10 @@ try:
trim_blocks=True, # do not output newline after blocks
autoescape=True, # XML/HTML automatic escaping
)
+ mako_template_env.globals.update({
+ 'str': str,
+ 'quote': quote,
+ })
except ImportError:
_logger.warning("jinja2 not available, templating features will not work!")
@@ -89,7 +93,6 @@ class email_template(osv.osv):
'object': record,
'user': user,
'ctx': context, # context kw would clash with mako internals
- 'quote': quote,
}
result = mako_template_env.from_string(template).render(variables)
if result == u"False":