From 786f0ad5ef0f3f2fa1fa6695801b3f6dd1f7f9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 2 Apr 2024 16:47:01 +0200 Subject: [PATCH] Do not deduce current payment from the amount of the sale Closes #13157 (grafted from 4222a311839fe3341a27e9c2be3d931403802be3) --HG-- branch : 7.0 --- modules/sale_payment/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/sale_payment/account.py b/modules/sale_payment/account.py index 53267ff9f7..2d8d2cb511 100644 --- a/modules/sale_payment/account.py +++ b/modules/sale_payment/account.py @@ -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'