From a9fb15b33fd041ee420581a5ba450017db06e0c7 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant <jpp@odoo.com> Date: Wed, 30 Oct 2019 13:50:18 +0000 Subject: [PATCH] [FIX] payment_*: multiwebsite base_url Fine-tunning of 937b5c076e7175bec664ed0cf4b77505e342f1e2 Have a multiwebsite setup have a payment installed for one of the two websites Make an order on that website and try to pay Before this commit, the transaction doesn't come back to odoo's payment success controller This was because the return url was set to the web base url ICP After this commit, the payment success page is opened as we took the request's url as the return url opw-2080352 closes odoo/odoo#39587 Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com> --- addons/payment_adyen/models/payment.py | 2 +- addons/payment_authorize/models/payment.py | 2 +- addons/payment_buckaroo/models/payment.py | 2 +- addons/payment_ogone/models/payment.py | 2 +- addons/payment_paypal/models/payment.py | 2 +- addons/payment_payumoney/models/payment.py | 2 +- addons/payment_sips/models/payment.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/payment_adyen/models/payment.py b/addons/payment_adyen/models/payment.py index 18dd7cc2a251..cf73409fabc3 100644 --- a/addons/payment_adyen/models/payment.py +++ b/addons/payment_adyen/models/payment.py @@ -150,7 +150,7 @@ class AcquirerAdyen(models.Model): @api.multi def adyen_form_generate_values(self, values): - base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + base_url = self.get_base_url() # tmp import datetime from dateutil import relativedelta diff --git a/addons/payment_authorize/models/payment.py b/addons/payment_authorize/models/payment.py index b1d9a2e6a1e3..9d00fb31a150 100644 --- a/addons/payment_authorize/models/payment.py +++ b/addons/payment_authorize/models/payment.py @@ -99,7 +99,7 @@ class PaymentAcquirerAuthorize(models.Model): if values.get('billing_partner_country') and values.get('billing_partner_country') == self.env.ref('base.us', False): billing_state = values['billing_partner_state'].code if values.get('billing_partner_state') else '' - base_url = self.env['ir.config_parameter'].get_param('web.base.url') + base_url = self.get_base_url() authorize_tx_values = dict(values) temp_authorize_tx_values = { 'x_login': self.authorize_login, diff --git a/addons/payment_buckaroo/models/payment.py b/addons/payment_buckaroo/models/payment.py index 552f1c3d93ec..638607e52350 100644 --- a/addons/payment_buckaroo/models/payment.py +++ b/addons/payment_buckaroo/models/payment.py @@ -83,7 +83,7 @@ class AcquirerBuckaroo(models.Model): @api.multi def buckaroo_form_generate_values(self, values): - base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + base_url = self.get_base_url() buckaroo_tx_values = dict(values) buckaroo_tx_values.update({ 'Brq_websitekey': self.brq_websitekey, diff --git a/addons/payment_ogone/models/payment.py b/addons/payment_ogone/models/payment.py index 30f888b19c8b..ff24ff05e56b 100644 --- a/addons/payment_ogone/models/payment.py +++ b/addons/payment_ogone/models/payment.py @@ -149,7 +149,7 @@ class PaymentAcquirerOgone(models.Model): return shasign def ogone_form_generate_values(self, values): - base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + base_url = self.get_base_url() ogone_tx_values = dict(values) param_plus = { 'return_url': ogone_tx_values.pop('return_url', False) diff --git a/addons/payment_paypal/models/payment.py b/addons/payment_paypal/models/payment.py index f83129749a92..9c42fdb599b5 100644 --- a/addons/payment_paypal/models/payment.py +++ b/addons/payment_paypal/models/payment.py @@ -91,7 +91,7 @@ class AcquirerPaypal(models.Model): @api.multi def paypal_form_generate_values(self, values): - base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + base_url = self.get_base_url() paypal_tx_values = dict(values) paypal_tx_values.update({ diff --git a/addons/payment_payumoney/models/payment.py b/addons/payment_payumoney/models/payment.py index 2a4be713e48a..c9b9f2a53ab7 100644 --- a/addons/payment_payumoney/models/payment.py +++ b/addons/payment_payumoney/models/payment.py @@ -55,7 +55,7 @@ class PaymentAcquirerPayumoney(models.Model): @api.multi def payumoney_form_generate_values(self, values): self.ensure_one() - base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + base_url = self.get_base_url() payumoney_values = dict(values, key=self.payumoney_merchant_key, txnid=values['reference'], diff --git a/addons/payment_sips/models/payment.py b/addons/payment_sips/models/payment.py index 90f0d0aad8d1..bfb44a32432b 100644 --- a/addons/payment_sips/models/payment.py +++ b/addons/payment_sips/models/payment.py @@ -69,7 +69,7 @@ class AcquirerSips(models.Model): @api.multi def sips_form_generate_values(self, values): self.ensure_one() - base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') + base_url = self.get_base_url() currency = self.env['res.currency'].sudo().browse(values['currency_id']) currency_code = CURRENCY_CODES.get(currency.name, False) if not currency_code: -- GitLab