[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
This commit is contained in:
Denis Ledoux 2014-12-04 14:46:24 +01:00
parent 9c7fb721f0
commit 4e9613609d
1 changed files with 5 additions and 2 deletions

View File

@ -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 = {