External refunds: automatically mark as done if they exactly fix an overpaid order

This commit is contained in:
Raphael Michel
2020-11-02 17:06:47 +01:00
parent 6ca6f9437f
commit 031ee647ab

View File

@@ -1600,6 +1600,10 @@ class OrderPayment(models.Model):
'local_id': r.local_id,
'provider': r.provider,
})
if self.order.pending_sum + r.amount == Decimal('0.00'):
self.refund.done()
return r