fix(account_balance_timeline)

This commit is contained in:
Rushabh Mehta 2019-04-16 09:33:21 +05:30
parent 557520148e
commit 7efe01578d

View File

@ -20,10 +20,10 @@ def get(chart_name=None, from_date = None, to_date = None):
account = filters.get("account") account = filters.get("account")
company = filters.get("company") company = filters.get("company")
if not from_date:
from_date = get_from_date_from_timespan(to_date, timespan)
if not to_date: if not to_date:
to_date = nowdate() to_date = nowdate()
if not from_date:
from_date = get_from_date_from_timespan(to_date, timespan)
# fetch dates to plot # fetch dates to plot
dates = get_dates_from_timegrain(from_date, to_date, timegrain) dates = get_dates_from_timegrain(from_date, to_date, timegrain)
@ -66,8 +66,8 @@ def build_result(account, dates, gl_entries):
# for balance sheet accounts, the totals are cumulative # for balance sheet accounts, the totals are cumulative
if root_type in ('Asset', 'Liability', 'Equity'): if root_type in ('Asset', 'Liability', 'Equity'):
for i, r in enumerate(result): for i, r in enumerate(result):
if i < 0: if i > 0:
r[1] = r[1] + result[i-1][1] r[i][1] = r[i][1] + result[i-1][1]
return result return result