From 6d2d30d6f53128a698c99bc2da97d50dbe5fc27f Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant 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#39643 X-original-commit: a9fb15b33fd041ee420581a5ba450017db06e0c7 Signed-off-by: Jorge Pinna Puissant (jpp) --- addons/payment_adyen/models/payment.py | 2 +- addons/payment_authorize/models/payment.py | 2 +- addons/payment_buckaroo/models/payment.py | 2 +- addons/payment_ingenico/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 584e28ab4a0..b1dce04c050 100644 --- a/addons/payment_adyen/models/payment.py +++ b/addons/payment_adyen/models/payment.py @@ -147,7 +147,7 @@ class AcquirerAdyen(models.Model): return base64.b64encode(hmac.new(key, sign, hashlib.sha1).digest()) 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 e7be116700d..93403af7104 100644 --- a/addons/payment_authorize/models/payment.py +++ b/addons/payment_authorize/models/payment.py @@ -84,7 +84,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 d0f9ed34741..67ceb82a451 100644 --- a/addons/payment_buckaroo/models/payment.py +++ b/addons/payment_buckaroo/models/payment.py @@ -82,7 +82,7 @@ class AcquirerBuckaroo(models.Model): return shasign 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_ingenico/models/payment.py b/addons/payment_ingenico/models/payment.py index fcc820e00fd..38a97ef2c81 100644 --- a/addons/payment_ingenico/models/payment.py +++ b/addons/payment_ingenico/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 78b9d6032dd..64afaf6ad7c 100644 --- a/addons/payment_paypal/models/payment.py +++ b/addons/payment_paypal/models/payment.py @@ -83,7 +83,7 @@ class AcquirerPaypal(models.Model): return fees 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 b8f60673031..5fafad61657 100644 --- a/addons/payment_payumoney/models/payment.py +++ b/addons/payment_payumoney/models/payment.py @@ -54,7 +54,7 @@ class PaymentAcquirerPayumoney(models.Model): 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 3f2087e5940..3e464fde64f 100644 --- a/addons/payment_sips/models/payment.py +++ b/addons/payment_sips/models/payment.py @@ -68,7 +68,7 @@ class AcquirerSips(models.Model): 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: