diff --git a/addons/payment/wizards/payment_link_wizard.py b/addons/payment/wizards/payment_link_wizard.py index 1c309534d12..fb6e02b9cf5 100644 --- a/addons/payment/wizards/payment_link_wizard.py +++ b/addons/payment/wizards/payment_link_wizard.py @@ -3,6 +3,8 @@ import hashlib import hmac +from werkzeug import urls + from odoo import api, fields, models, _ from odoo.exceptions import ValidationError from odoo.tools import ustr, consteq @@ -59,7 +61,7 @@ class PaymentLinkWizard(models.TransientModel): def _generate_link(self): base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') for payment_link in self: - payment_link.link = '%s/website_payment/pay?reference=%s&amount=%s¤cy_id=%s&partner_id=%s&access_token=%s' % (base_url, payment_link.description, payment_link.amount, payment_link.currency_id.id, payment_link.partner_id.id, payment_link.access_token) + payment_link.link = '%s/website_payment/pay?reference=%s&amount=%s¤cy_id=%s&partner_id=%s&access_token=%s' % (base_url, urls.url_quote(payment_link.description), payment_link.amount, payment_link.currency_id.id, payment_link.partner_id.id, payment_link.access_token) @api.model def check_token(self, access_token, partner_id, amount, currency_id): diff --git a/addons/sale/wizard/sale_payment_link.py b/addons/sale/wizard/sale_payment_link.py index 6ea2930fbd3..e6f4e1ded93 100644 --- a/addons/sale/wizard/sale_payment_link.py +++ b/addons/sale/wizard/sale_payment_link.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from werkzeug import urls + from odoo import api, models @@ -26,4 +28,4 @@ class SalePaymentLink(models.TransientModel): """ Override of the base method to add the order_id in the link. """ base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') for payment_link in self: - payment_link.link = '%s/website_payment/pay?reference=%s&amount=%s¤cy_id=%s&partner_id=%s&order_id=%s&access_token=%s' % (base_url, payment_link.description, payment_link.amount, payment_link.currency_id.id, payment_link.partner_id.id, payment_link.res_id, payment_link.access_token) + payment_link.link = '%s/website_payment/pay?reference=%s&amount=%s¤cy_id=%s&partner_id=%s&order_id=%s&access_token=%s' % (base_url, urls.url_quote(payment_link.description), payment_link.amount, payment_link.currency_id.id, payment_link.partner_id.id, payment_link.res_id, payment_link.access_token)