[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.
This commit is contained in:
Thibault Delavallée
2017-08-25 15:33:16 +02:00
parent 8f93369d83
commit 8e4a0c19b3
+1 -1
View File
@@ -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()