From 8e4a0c19b382a9ccaf899653c5461694f9adb26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 9 Aug 2017 17:22:53 +0200 Subject: [PATCH] [IMP] sale_payment: make payment code more sale limited Purpose is to have methods on transactions can be called and that handle correctly transactions linked to a sale order, but also in a near future to an invoice, a subscription, several of them, none of them, ... This commit already checks that sale order related code for payment transactions is run only when a sale order is linked to a transaction. --- addons/sale_payment/models/payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_payment/models/payment.py b/addons/sale_payment/models/payment.py index a6b6ef3b209..50bc52fa4e1 100644 --- a/addons/sale_payment/models/payment.py +++ b/addons/sale_payment/models/payment.py @@ -32,7 +32,7 @@ class PaymentTransaction(models.Model): tx = getattr(self, tx_find_method_name)(data) _logger.info('<%s> transaction processed: tx ref:%s, tx amount: %s', acquirer_name, tx.reference if tx else 'n/a', tx.amount if tx else 'n/a') - if tx: + if tx and tx.sale_order_id: # Auto-confirm SO if necessary tx._confirm_so()