models.reporting_period
Represents a financial cycle of an Entity.
Module Contents
Classes
Represents a financial cycle for the Reporting Entity. |
- class models.reporting_period.ReportingPeriod
Bases:
python_accounting.mixins.IsolatingMixin,python_accounting.models.RecyclableRepresents a financial cycle for the Reporting Entity.
- class Status(*args, **kwds)
Bases:
enum.EnumRepresents a Reporting Period’s status.
- OPEN = 0
The period is current and Transactions may be posted to it.
- ADJUSTING = 1
The period is past and only Journal Entry Transactions may be posted to it (E.g Audit Adjustments).
- CLOSED = 2
The period is past and no more Transactions may be posted to it.
- __tablename__ = 'reporting_period'
- __table_args__ = ()
- __mapper_args__
- id: sqlalchemy.orm.Mapped[int]
The primary key of the Reporting Period database record.
- Type:
(int)
- calendar_year: sqlalchemy.orm.Mapped[int]
The calendar year associated with the ReportingPeriod.
- Type:
(int)
- period_count: sqlalchemy.orm.Mapped[int]
The number of periods since the system has been in use by the Entity.
- Type:
(int)
- status: sqlalchemy.orm.Mapped[ReportingPeriod.Status]
The status of the Reporting Period.
- Type:
- __repr__() str
- static date_year(date: datetime.datetime = None, entity=None) int
Returns the calendar year for the given date.
- Parameters:
date (datetime, optional) – The date whose calendar year is to be found. Defaults to the current date.
entity (int, optional) – The Entity for whom the calendar year is to be found. If absent, defaults to the calendar year.
- Returns:
The calendar year.
- Return type:
int
- static get_period(session, date: datetime.datetime) ReportingPeriod
Returns the reporting period for the given date.
- Parameters:
session (Session) – The accounting session to which the Reporting Period belongs.
date (datetime) – The date whose Reporting Period is to be found.
- Raises:
MissingReportingPeriodError – If there no Reporting Period exists for the given date.
- Returns:
The Reporting Period.
- Return type:
- validate(session) None
Validates the Reporting Period properties.
- Parameters:
session (Session) – The accounting session to which the ReportingPeriod belongs.
- Raises:
DuplicateReportingPeriodError – If there already exists a Reporting Period for the same calendar year.
MultipleOpenPeriodsError – If there already exists a Reporting Period in the OPEN status.
- Returns:
None
- interval(date: datetime.datetime = None) dict
Returns the start and end dates of the Reporting Period.
- Parameters:
session (Session) – The accounting session to which the Reporting Period belongs.
date (datetime) – The date for whose Reporting Period’s interval is to be found.
- Raises:
MissingReportingPeriodError – If there no Reporting Period exists for the given date.
- Returns:
The Reporting Period.
- Return type: