[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:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user