fix: add translate function to period in stock_analytics.py

This commit is contained in:
Ernesto Ruiz 2022-10-25 22:09:02 -06:00 committed by GitHub
parent 71a0ae2e59
commit c1e608d9ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,11 +114,11 @@ def get_period(posting_date, filters):
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
if filters.range == "Weekly":
period = "Week " + str(posting_date.isocalendar()[1]) + " " + str(posting_date.year)
period = _("Week {0} {1}").format(str(posting_date.isocalendar()[1]), str(posting_date.year))
elif filters.range == "Monthly":
period = str(months[posting_date.month - 1]) + " " + str(posting_date.year)
period = _(str(months[posting_date.month - 1])) + " " + str(posting_date.year)
elif filters.range == "Quarterly":
period = "Quarter " + str(((posting_date.month - 1) // 3) + 1) + " " + str(posting_date.year)
period = _("Quarter {0} {1}").format(str(((posting_date.month - 1) // 3) + 1), str(posting_date.year))
else:
year = get_fiscal_year(posting_date, company=filters.company)
period = str(year[2])