From ff4e96a0c7064debed6fa7a5953d965d472c4284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 5 Jan 2023 17:26:36 +0100 Subject: [PATCH] Remove aliases from grouped columns of move line when used in "group by" Closes #11993 --- modules/account_move_line_grouping/account.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/account_move_line_grouping/account.py b/modules/account_move_line_grouping/account.py index 973145a1eb..7083392a82 100644 --- a/modules/account_move_line_grouping/account.py +++ b/modules/account_move_line_grouping/account.py @@ -1,6 +1,6 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -from sql import Literal, Null, Select, Window +from sql import As, Literal, Null, Select, Window from sql.aggregate import BoolAnd, BoolOr, Min, Sum from sql.functions import CurrentTimestamp, FirstValue @@ -149,6 +149,8 @@ class MoveLineGroup(MoveLineMixin, ModelSQL, ModelView): aggregated_columns = cls._aggregated_columns(line) columns = std_columns + grouped_columns + aggregated_columns + grouped_columns = [ + c.expression if isinstance(c, As) else c for c in grouped_columns] return line.select(*columns, group_by=grouped_columns) @classmethod