[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
This commit is contained in:
Martin Trigaux
2016-12-09 10:47:51 +01:00
parent b27787c92c
commit d29c40e1e1
+1 -1
View File
@@ -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