From 7e5ef52975d0945057b5630db94783401bea71db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 12 Dec 2024 00:42:58 +0100 Subject: [PATCH] Group on company currency in sale reporting It is needed to construct unique ID when grouping by other mean than the line id. Also the revenue is computed in the company currency. Closes #13744 --- modules/sale/sale_reporting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/sale/sale_reporting.py b/modules/sale/sale_reporting.py index bd8b704e8c..a711a371f6 100644 --- a/modules/sale/sale_reporting.py +++ b/modules/sale/sale_reporting.py @@ -136,7 +136,7 @@ class Abstract(ModelSQL): line.company.as_('company'), revenue.as_('revenue'), Count(line.order, distinct=True).as_('number'), - line.currency.as_('currency'), + currency.id.as_('currency'), ] @classmethod @@ -148,7 +148,7 @@ class Abstract(ModelSQL): def _group_by(cls, tables, withs): line = tables['line'] currency = tables['line.company.currency'] - return [line.company, line.currency, currency.digits] + return [line.company, currency.id, currency.digits] @classmethod def _where(cls, tables, withs):