Do not deduce current payment from the amount of the sale

Closes #13157
(grafted from 4222a311839fe3341a27e9c2be3d931403802be3)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2024-04-02 16:47:01 +02:00
1 parent 8f320389a3
commit 786f0ad5ef
1 file changed
+1 -1
+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'