From 21c8685f787314ef4877a7bba2228fdf0930b444 Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Thu, 6 Oct 2022 11:19:32 +0000 Subject: [PATCH] [FIX] account: reports: allow constant factors when expanding an aggregation expression Before this fix, the expansion helper did not support formulas in the form LINE1.label / LINE2.label * 100 because "100" couldn't be splitted between line code and expression label. This case is now supported, as it is required for reports needing to compute percentages using other lines' values, like the executive summary. closes odoo/odoo#102470 X-original-commit: ea2347e7ce43f8129568e6d4a8734ea8ebfc3b96 Related: odoo/enterprise#32425 Signed-off-by: Laurent Smet Signed-off-by: Olivier Colson (oco) --- addons/account/models/account_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_report.py b/addons/account/models/account_report.py index f39570d957d..969a52e76df 100644 --- a/addons/account/models/account_report.py +++ b/addons/account/models/account_report.py @@ -511,7 +511,7 @@ class AccountReportExpression(models.Model): expression_terms = re.split('[-+/*]', re.sub(r'[\s()]', '', expression.formula)) for term in expression_terms: - if term: # term might be empty if the formula contains a negative term + if term and not re.match(r'^([0-9]*[.])?[0-9]*$', term): # term might be empty if the formula contains a negative term line_code, total_name = term.split('.') totals_by_code[line_code].add(total_name)