[FIX] payment: provide missing return_url in values

Render from payment//payment_acquirer.py promises:
All templates will receive:
    'feedback_url', 'return_url', 'cancel_url', 'error_url'
However they are all in -> FIXME.
After 6 years in FIXME, this promise is still a lie.

It is unfortunate since the Adyen payment provider requires 'return_url' to work.
Before, this function was called by _get_shop_payment_values,
which provided a value for it.
We copy the value that was given there directly as a default in render,
so that it doesn't crash no matter what method calls it.

opw 1928918
opw 1944142

closes odoo/odoo#31814

Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
This commit is contained in:
Nans Lefebvre
2019-03-15 14:56:19 +00:00
parent d7ca0357f3
commit fc1389f8d8
+1 -1
View File
@@ -356,6 +356,7 @@ class PaymentAcquirer(models.Model):
if values is None:
values = {}
values.setdefault('return_url', '/payment/process')
# reference and amount
values.setdefault('reference', reference)
amount = float_round(amount, 2)
@@ -447,7 +448,6 @@ class PaymentAcquirer(models.Model):
'context': self._context,
'type': values.get('type') or 'form',
})
values.setdefault('return_url', False)
_logger.info('payment.acquirer.render: <%s> values rendered for form payment:\n%s', self.provider, pprint.pformat(values))
return self.view_template_id.render(values, engine='ir.qweb')