From b50911d36cf9cb3bc03ed4cd6d069d151eb978b4 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 --- 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'