summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToufik Benjaa <tbe@odoo.com>2018-09-20 15:44:06 +0200
committerToufik Benjaa <tbe@odoo.com>2018-09-24 11:21:16 +0200
commit8d090e0835ff586d1caee0926c34103c7c91ee76 (patch)
tree4b3ffbc44ffb3c279dbc407fa24d2997fda074a7
parenta2632331fb71d571eaffbfbd39e813af145b97e5 (diff)
[FIX] sale: crash when creating a transaction
- When creating a transaction, the method render_sale_button was called with an extra parameter.
-rw-r--r--addons/sale/controllers/portal.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/addons/sale/controllers/portal.py b/addons/sale/controllers/portal.py
index 1b38e714e40..7705f10e4e9 100644
--- a/addons/sale/controllers/portal.py
+++ b/addons/sale/controllers/portal.py
@@ -4,6 +4,7 @@
from odoo import fields, http, _
from odoo.exceptions import AccessError, MissingError
from odoo.http import request
+from odoo.addons.payment.controllers.portal import PaymentProcessing
from odoo.addons.portal.controllers.mail import _message_post_helper
from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager, get_records_pager
from odoo.osv import expression
@@ -266,13 +267,13 @@ class CustomerPortal(CustomerPortal):
vals = {
'acquirer_id': acquirer_id,
'type': order._get_payment_type(),
+ 'return_url': order.get_portal_url(),
}
transaction = order._create_payment_transaction(vals)
-
+ PaymentProcessing.add_payment_transaction(transaction)
return transaction.render_sale_button(
order,
- order.get_portal_url(),
submit_txt=_('Pay & Confirm'),
render_values={
'type': order._get_payment_type(),
@@ -299,8 +300,9 @@ class CustomerPortal(CustomerPortal):
vals = {
'payment_token_id': pm_id,
'type': 'server2server',
+ 'return_url': order.get_portal_url(),
}
- order._create_payment_transaction(vals)
-
- return request.redirect(order.get_portal_url())
+ tx = order._create_payment_transaction(vals)
+ PaymentProcessing.add_payment_transaction(tx)
+ return request.redirect('/payment/process')