From d29c40e1e1c1ae0d505d27159bccab2e8dd31083 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 9 Dec 2016 10:20:12 +0100 Subject: [PATCH] [FIX] payment_paypal: avoid crash in validation without reference When `paypal_validate_data` is called without any reference, `tx` is None. Before the migration, it was catched by a `tx and tx.acquired_id` but it is no longer the case. Introduced at f1ac1b12 Fixes #13834 --- addons/payment_paypal/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/payment_paypal/controllers/main.py b/addons/payment_paypal/controllers/main.py index 08ee37b3f3b..621b598d6bc 100644 --- a/addons/payment_paypal/controllers/main.py +++ b/addons/payment_paypal/controllers/main.py @@ -56,7 +56,7 @@ class PaypalController(http.Controller): tx = None if reference: tx = request.env['payment.transaction'].search([('reference', '=', reference)]) - paypal_urls = tx.acquirer_id._get_paypal_urls(tx.acquirer_id.environment or 'prod') + paypal_urls = request.env['payment.acquirer']._get_paypal_urls(tx and tx.acquirer_id.environment or 'prod') pdt_request = bool(new_post.get('amt')) # check for spefific pdt param if pdt_request: # this means we are in PDT instead of DPN like before