fix: Period list for exponential smoothing forecasting report (#24982)

This commit is contained in:
Deepesh Garg 2021-03-23 21:11:01 +05:30 committed by GitHub
parent 12f0923a61
commit 82983369fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -51,7 +51,11 @@ def get_period_list(from_fiscal_year, to_fiscal_year, period_start_date, period_
"from_date": start_date
})
to_date = add_months(start_date, months_to_add)
if i==0 and filter_based_on == 'Date Range':
to_date = add_months(get_first_day(start_date), months_to_add)
else:
to_date = add_months(start_date, months_to_add)
start_date = to_date
# Subtract one day from to_date, as it may be first day in next fiscal year or month

View File

@ -61,7 +61,7 @@ class ForecastingReport(ExponentialSmoothingForecast):
from_date = add_years(self.filters.from_date, cint(self.filters.no_of_years) * -1)
self.period_list = get_period_list(from_date, self.filters.to_date,
from_date, self.filters.to_date, None, self.filters.periodicity, ignore_fiscal_year=True)
from_date, self.filters.to_date, "Date Range", self.filters.periodicity, ignore_fiscal_year=True)
order_data = self.get_data_for_forecast() or []