fix: deferred report division by zero exception

This commit is contained in:
ruthra 2022-01-07 16:30:56 +05:30
parent 44407e63d8
commit fe4d7f86ee

View File

@ -121,20 +121,21 @@ class Deferred_Item(object):
""" """
simulate future posting by creating dummy gl entries. starts from the last posting date. simulate future posting by creating dummy gl entries. starts from the last posting date.
""" """
if add_days(self.last_entry_date, 1) < self.period_list[-1].to_date: if self.service_start_date != self.service_end_date:
self.estimate_for_period_list = get_period_list( if add_days(self.last_entry_date, 1) < self.period_list[-1].to_date:
self.filters.from_fiscal_year, self.estimate_for_period_list = get_period_list(
self.filters.to_fiscal_year, self.filters.from_fiscal_year,
add_days(self.last_entry_date, 1), self.filters.to_fiscal_year,
self.period_list[-1].to_date, add_days(self.last_entry_date, 1),
"Date Range", self.period_list[-1].to_date,
"Monthly", "Date Range",
company=self.filters.company, "Monthly",
) company=self.filters.company,
for period in self.estimate_for_period_list: )
amount = self.calculate_amount(period.from_date, period.to_date) for period in self.estimate_for_period_list:
gle = self.make_dummy_gle(period.key, period.to_date, amount) amount = self.calculate_amount(period.from_date, period.to_date)
self.gle_entries.append(gle) gle = self.make_dummy_gle(period.key, period.to_date, amount)
self.gle_entries.append(gle)
def calculate_item_revenue_expense_for_period(self): def calculate_item_revenue_expense_for_period(self):
""" """