From 4e9613609de96200d1347b243722400e915848a0 Mon Sep 17 00:00:00 2001
From: Denis Ledoux <dle@odoo.com>
Date: Thu, 4 Dec 2014 14:46:24 +0100
Subject: [PATCH] [FIX] sale: rounded sales team invoiced gauge

The price_total field of the account invoice report is not rounded (it cannot be easily rounded, as this has to be done in the sql view)
In a multi currencies environment, this is possible that the price_total value has a lot of digits
We therefore round it manually, for the gauge of the sales team kanban view
---
 addons/sale/sales_team.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/addons/sale/sales_team.py b/addons/sale/sales_team.py
index b6013838791b..c782660d0ea0 100644
--- a/addons/sale/sales_team.py
+++ b/addons/sale/sales_team.py
@@ -7,7 +7,7 @@ import json
 
 from openerp import tools
 from openerp.osv import fields, osv
-
+from openerp.tools.float_utils import float_repr
 
 class crm_case_section(osv.osv):
     _inherit = 'crm.case.section'
@@ -37,7 +37,10 @@ class crm_case_section(osv.osv):
         res = {}
         for id in ids:
             created_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'cancel']), ('date', '>=', date_begin), ('date', '<=', date_end)]
-            res[id] = json.dumps(self.__get_bar_values(cr, uid, obj, created_domain, ['price_total', 'date'], 'price_total', 'date', context=context))
+            values = self.__get_bar_values(cr, uid, obj, created_domain, ['price_total', 'date'], 'price_total', 'date', context=context)
+            for value in values:
+                value['value'] = float_repr(value.get('value', 0), precision_digits=self.pool['decimal.precision'].precision_get(cr, uid, 'Account'))
+            res[id] = json.dumps(values)
         return res
 
     _columns = {
-- 
GitLab