diff --git a/addons/portal_sale/portal_sale.py b/addons/portal_sale/portal_sale.py
index 62f3f1ff9cc..3556fd5ca0e 100644
--- a/addons/portal_sale/portal_sale.py
+++ b/addons/portal_sale/portal_sale.py
@@ -74,6 +74,14 @@ class sale_order(osv.Model):
mail_obj.send(cr, uid, [mail_id], recipient_ids=[partner.id], context=context)
return super(sale_order, self).action_button_confirm(cr, uid, ids, context=context)
+ def get_signup_url(self, cr, uid, ids, context=None):
+ assert len(ids) == 1
+ document = self.browse(cr, uid, ids[0], context=context)
+ partner = document.partner_id
+ action = 'portal_sale.action_quotations_portal' if document.state in ('draft', 'sent') else 'portal_sale.action_orders_portal'
+ partner.signup_prepare()
+ return partner._get_signup_url_for_action(action=action, view_type='form', res_id=document.id)[partner.id]
+
class account_invoice(osv.Model):
_inherit = 'account.invoice'
@@ -126,6 +134,14 @@ class account_invoice(osv.Model):
mail_obj.send(cr, uid, [mail_id], recipient_ids=[partner.id], context=context)
return super(account_invoice, self).invoice_validate(cr, uid, ids, context=context)
+ def get_signup_url(self, cr, uid, ids, context=None):
+ assert len(ids) == 1
+ document = self.browse(cr, uid, ids[0], context=context)
+ partner = document.partner_id
+ action = 'portal_sale.portal_action_invoices'
+ partner.signup_prepare()
+ return partner._get_signup_url_for_action(action=action, view_type='form', res_id=document.id)[partner.id]
+
class mail_mail(osv.osv):
_inherit = 'mail.mail'
diff --git a/addons/portal_sale/portal_sale_data.xml b/addons/portal_sale/portal_sale_data.xml
index f40897f6998..bdf51fd2fe7 100644
--- a/addons/portal_sale/portal_sale_data.xml
+++ b/addons/portal_sale/portal_sale_data.xml
@@ -6,7 +6,7 @@
Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''}, Hello ${object.partner_id.name or ''}, Here is your ${object.state in ('draft', 'sent') and 'quotation' or 'order confirmation'} from ${object.company_id.name}:
% endif
% if object.user_id:
- Your contact: ${object.user_id.name}
+ Your contact: ${object.user_id.name}
% endif
You can access this document and pay online via our Customer Portal:
View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} + href="${signup_url|safe}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} % endif % if object.order_policy in ('prepaid','manual') and object.company_id.paypal_account and object.state != 'draft': - <% - comp_name = quote(object.company_id.name) - order_name = quote(object.name) - paypal_account = quote(object.company_id.paypal_account) - order_amount = quote(str(object.residual)) - cur_name = quote(object.pricelist_id.currency_id.name) - paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Order%%20%s" \ - "&invoice=%s&amount=%s¤cy_code=%s&button_subtype=services&no_note=1" \ - "&bn=OpenERP_Order_PayNow_%s" % \ - (paypal_account,comp_name,order_name,order_name,order_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%%20Order%%20%(order_name)s" + "&invoice=%(order_name)s" + "&amount=%(order_amount)s" + "¤cy_code=%(currency)s" + "&button_subtype=services" + "&no_note=1" + "&bn=OpenERP_Order_PayNow_%(currency)s" + % { + 'paypal_account': quote(object.company_id.paypal_account), + 'company_name': quote(object.company_id.name), + 'order_name': quote(object.name), + 'order_amount': quote(str(object.residual)), + 'currency': quote(object.pricelist_id.currency_id.name), + }) %>It is also possible to directly pay with Paypal:
- +
% endif
@@ -99,9 +101,9 @@
% endif
% if object.company_id.website:
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:
@@ -133,15 +135,11 @@ Order reference: ${object.origin}
You can access the invoice document and pay online via our Customer Portal:
@@ -151,19 +149,26 @@
% 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
@@ -199,9 +204,9 @@
% endif
% if object.company_id.website: