Do not deduce current payment from the amount of the sale

Closes #13157
This commit is contained in:
Cédric Krier
2024-04-02 16:47:01 +02:00
parent 70f068b318
commit b50911d36c
+1 -1
View File
@@ -62,7 +62,7 @@ class Payment(metaclass=PoolMeta):
sale_amount = getattr(sale, 'total_amount', None)
payment_amount = sum(
(p.amount for p in getattr(sale, 'payments', [])
if p.state != 'failed'),
if p.state != 'failed' and p != self),
Decimal(0))
if sale_amount is not None:
self.kind = 'receivable' if sale_amount > 0 else 'payable'