From e4b7dce7618ab4c0eaa59f67c46780af5921c135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 18 Apr 2025 12:30:59 +0200 Subject: [PATCH] Always fill debit and credit of grouped account move line The inherited MoveLineMixin is expecting those fields to be always filled. Closes #13976 (grafted from 1c31d847a5569bede9f2b2ac1580b2f7b025220f) --HG-- branch : 7.0 --- modules/account_move_line_grouping/account.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/account_move_line_grouping/account.py b/modules/account_move_line_grouping/account.py index 569ef407ce..f857fff042 100644 --- a/modules/account_move_line_grouping/account.py +++ b/modules/account_move_line_grouping/account.py @@ -2,6 +2,7 @@ # this repository contains the full copyright notices and license terms. from sql import As, Literal, Null, Select, Window from sql.aggregate import BoolAnd, BoolOr, Min, Sum +from sql.conditionals import Coalesce from sql.functions import CurrentTimestamp, FirstValue from trytond.model import ModelSQL, ModelView, fields @@ -177,8 +178,8 @@ class MoveLineGroup(MoveLineMixin, ModelSQL, ModelView): else: filter_ = None return [ - Sum(line.debit, filter_=filter_).as_('debit'), - Sum(line.credit, filter_=filter_).as_('credit'), + Coalesce(Sum(line.debit, filter_=filter_), 0).as_('debit'), + Coalesce(Sum(line.credit, filter_=filter_), 0).as_('credit'), Sum(line.amount_second_currency, filter_=filter_).as_( 'amount_second_currency'), BoolOr(line.reconciliation != Null).as_('partially_reconciled'),