[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@9148960174.

*Do not forward port, already ported to 12.0 via
 odoo/enterprise#2975 (odoo/enterprise@a1484e650c)*

opw-1904481
This commit is contained in:
Joren Van Onder
2018-10-30 10:35:49 -07:00
parent ca3a1f51d8
commit c2bc338150
@@ -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