[FIX] account: dashboard graphs proper float rounding
Steps to reproduce: - install accounting - go to the accounting main view and hover some of the graphs Previous behavior: rounding was inconsistent and would lead to weird js floats like 65.00000000000001 Current behavior: floats are rounded to 2 digits after opw-2172686 closes odoo/odoo#45336 X-original-commit: c00f4962eb790787fffef99595ac14dbef026055 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -84,6 +84,7 @@ class account_journal(models.Model):
|
||||
# Below method is used to get data of bank and cash statemens
|
||||
def get_line_graph_datas(self):
|
||||
"""Computes the data used to display the graph for bank and cash journals in the accounting dashboard"""
|
||||
currency = self.currency_id or self.company_id.currency_id
|
||||
|
||||
def build_graph_data(date, amount):
|
||||
#display date in locale format
|
||||
@@ -123,7 +124,7 @@ class account_journal(models.Model):
|
||||
date = val['date']
|
||||
if date != today.strftime(DF): # make sure the last point in the graph is today
|
||||
data[:0] = [build_graph_data(date, amount)]
|
||||
amount -= val['amount']
|
||||
amount = currency.round(amount - val['amount'])
|
||||
|
||||
# make sure the graph starts 1 month ago
|
||||
if date.strftime(DF) != last_month.strftime(DF):
|
||||
|
||||
Reference in New Issue
Block a user