Skip to content

Commit

Permalink
fix: limit end date to current date
Browse files Browse the repository at this point in the history
(cherry picked from commit ab6e92a)
  • Loading branch information
GursheenK authored and mergify[bot] committed Dec 5, 2023
1 parent 39e04b1 commit dbdb971
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion erpnext/accounts/report/financial_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@

import frappe
from frappe import _
from frappe.utils import add_days, add_months, cint, cstr, flt, formatdate, get_first_day, getdate
from frappe.utils import (
add_days,
add_months,
cint,
cstr,
flt,
formatdate,
get_first_day,
getdate,
today,
)

from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
get_accounting_dimensions,
Expand Down Expand Up @@ -43,6 +53,8 @@ def get_period_list(
year_start_date = getdate(period_start_date)
year_end_date = getdate(period_end_date)

year_end_date = getdate(today()) if year_end_date > getdate(today()) else year_end_date

months_to_add = {"Yearly": 12, "Half-Yearly": 6, "Quarterly": 3, "Monthly": 1}[periodicity]

period_list = []
Expand Down

0 comments on commit dbdb971

Please sign in to comment.