From 83b8037eca79a7adfed8b191e69abf590d499f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 7 Apr 2023 17:03:03 +0200 Subject: [PATCH] Limit debit and credit kind to line with debit and credit in aged balance Closes #12193 --- modules/account/account.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/account/account.py b/modules/account/account.py index 71ba590967..b9a559aa20 100644 --- a/modules/account/account.py +++ b/modules/account/account.py @@ -2915,8 +2915,12 @@ class AgedBalance(ModelSQL, ModelView): with Transaction().set_context(date=None): line_query, _ = MoveLine.query_get(line) kind = cls.get_kind(type_) - debit_kind = cls.get_kind(debit_type) - credit_kind = cls.get_kind(credit_type) + debit_kind = ( + cls.get_kind(debit_type) + & (line.debit != 0)) + credit_kind = ( + cls.get_kind(credit_type) + & (line.credit != 0)) columns = [ line.party.as_('id'), Literal(0).as_('create_uid'),