From c2bc3381508bfb002cb9af3c3b6655273f8c07d6 Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Mon, 29 Oct 2018 12:29:22 -0700 Subject: [PATCH] [FIX] account_budget: properly calculate percentage sum in read_group The percentage field is computed in _compute_percentage as a value between 0 and 1. This is good because that's what widget="percentage" in views expects. This makes read_group also return a value between 0 and 1, instead of 0 and 100. Otherwise list views will show e.g. 5000% when grouping lines that sum to 50%. Introduced in saas-11.4 at odoo/odoo@9148960174bdb0abbee6a5b7403a8f. *Do not forward port, already ported to 12.0 via odoo/enterprise#2975 (odoo/enterprise@a1484e650cb013f35755d)* opw-1904481 --- addons/account_budget/models/account_budget.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_budget/models/account_budget.py b/addons/account_budget/models/account_budget.py index d5500c2d623..0a92628cab4 100644 --- a/addons/account_budget/models/account_budget.py +++ b/addons/account_budget/models/account_budget.py @@ -145,7 +145,7 @@ class CrossoveredBudgetLines(models.Model): if group_line['theoritical_amount']: # use a weighted average group_line['percentage'] = float( - (group_line['practical_amount'] or 0.0) / group_line['theoritical_amount']) * 100 + (group_line['practical_amount'] or 0.0) / group_line['theoritical_amount']) return result