summaryrefslogtreecommitdiff
path: root/addons/payment
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-09-24 16:59:15 +0000
committerChristophe Simonis <chs@odoo.com>2019-09-24 17:45:37 +0000
commitd67b2483e5bfa5d8c1e6ef1a64fb933f5e080ad5 (patch)
tree25a7fd39ac993f3c04c5d8408beb628b3c9948ce /addons/payment
parent38d8b0526f0fccc32df5a11f5d086a3522ed5fcf (diff)
parent9ed4872ea03f28012118ed48a43d0800617a84f3 (diff)
[MERGE] forward port branch saas-12.4 up to 9ed4872ea03
closes odoo/odoo#37372 Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'addons/payment')
-rw-r--r--addons/payment/models/payment_acquirer.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py
index d23658ffa5d..9f56664d7bd 100644
--- a/addons/payment/models/payment_acquirer.py
+++ b/addons/payment/models/payment_acquirer.py
@@ -13,6 +13,7 @@ from odoo.addons.base.models import ir_module
from odoo.exceptions import ValidationError
from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
from odoo.tools.misc import formatLang
+from odoo.http import request
_logger = logging.getLogger(__name__)
@@ -221,6 +222,19 @@ class PaymentAcquirer(models.Model):
if field_names:
raise ValidationError(_("Required fields not filled: %s") % ", ".join(field_names))
+ def get_base_url(self):
+ self.ensure_one()
+ # priority is always given to url_root
+ # from the request
+ url = ''
+ if request:
+ url = request.httprequest.url_root
+
+ if not url and 'website_id' in self and self.website_id:
+ url = self.website_id._get_http_domain()
+
+ return url or self.env['ir.config_parameter'].sudo().get_param('web.base.url')
+
def _get_feature_support(self):
"""Get advanced feature support by provider.