diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py index 4f57aa66c1a8af3591b1f0ca246c926ade690479..16f86239bcce39bcd2f139b50a4e60b583be4f7d 100644 --- a/addons/payment/controllers/portal.py +++ b/addons/payment/controllers/portal.py @@ -236,6 +236,7 @@ class WebsitePayment(http.Controller): def payment_token(self, pm_id, reference, amount, currency_id, return_url=None, **kwargs): token = request.env['payment.token'].browse(int(pm_id)) order_id = kwargs.get('order_id') + invoice_id = kwargs.get('invoice_id') if not token: return request.redirect('/website_payment/pay?error_msg=%s' % _('Cannot setup the payment.')) @@ -255,6 +256,8 @@ class WebsitePayment(http.Controller): if order_id: values['sale_order_ids'] = [(6, 0, [order_id])] + if invoice_id: + values['invoice_ids'] = [(6, 0, [int(invoice_id)])] tx = request.env['payment.transaction'].sudo().with_context(lang=None).create(values) PaymentProcessing.add_payment_transaction(tx)