Added the AllTime class as a named period.
This commit is contained in:
parent
7c4102be44
commit
d31e495f6b
@ -116,6 +116,7 @@ class Period:
|
|||||||
"last-year": lambda: LastYear(),
|
"last-year": lambda: LastYear(),
|
||||||
"today": lambda: Today(),
|
"today": lambda: Today(),
|
||||||
"yesterday": lambda: Yesterday(),
|
"yesterday": lambda: Yesterday(),
|
||||||
|
"all-time": lambda: AllTime(),
|
||||||
}
|
}
|
||||||
if spec in named_periods:
|
if spec in named_periods:
|
||||||
return named_periods[spec]()
|
return named_periods[spec]()
|
||||||
@ -531,6 +532,18 @@ class Yesterday(Period):
|
|||||||
self.is_yesterday = True
|
self.is_yesterday = True
|
||||||
|
|
||||||
|
|
||||||
|
class AllTime(Period):
|
||||||
|
"""The period of all time."""
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(None, None)
|
||||||
|
self.is_this_year = True
|
||||||
|
|
||||||
|
def _set_properties(self) -> None:
|
||||||
|
self.spec = "all-time"
|
||||||
|
self.desc = gettext("All")
|
||||||
|
self.is_all = True
|
||||||
|
|
||||||
|
|
||||||
class TemplatePeriod(Period):
|
class TemplatePeriod(Period):
|
||||||
"""The period template."""
|
"""The period template."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -25,7 +25,7 @@ from datetime import date
|
|||||||
|
|
||||||
from accounting.models import Transaction
|
from accounting.models import Transaction
|
||||||
from accounting.report.period import YearPeriod, Period, ThisMonth, \
|
from accounting.report.period import YearPeriod, Period, ThisMonth, \
|
||||||
LastMonth, SinceLastMonth, ThisYear, LastYear, Today, Yesterday, \
|
LastMonth, SinceLastMonth, ThisYear, LastYear, Today, Yesterday, AllTime, \
|
||||||
TemplatePeriod
|
TemplatePeriod
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class PeriodChooser:
|
|||||||
"""The URL for today."""
|
"""The URL for today."""
|
||||||
self.yesterday_url: str = get_url(Yesterday())
|
self.yesterday_url: str = get_url(Yesterday())
|
||||||
"""The URL for yesterday."""
|
"""The URL for yesterday."""
|
||||||
self.all_url: str = get_url(Period(None, None))
|
self.all_url: str = get_url(AllTime())
|
||||||
"""The URL for all period."""
|
"""The URL for all period."""
|
||||||
self.url_template: str = get_url(TemplatePeriod())
|
self.url_template: str = get_url(TemplatePeriod())
|
||||||
"""The URL template."""
|
"""The URL template."""
|
||||||
|
Loading…
Reference in New Issue
Block a user