fiscalyears Package

models Module

class fiscalyears.models.FiscalYear(*args, **kwargs)[source]

A model for storing data about the Company’s Past and Present Fiscal Years.

The Current Fiscal Year is used for generating Account balance’s and Archiving Account instances into HistoricalAccounts.

See also

View add_fiscal_year()
This view processes all actions required for starting a New Fiscal Year.
year

The ending Year of the Financial Year.

end_month

The ending Month of the Financial Year. Stored as integers, displayed with full names.

period

The length of the Fiscal Year in months. Available choices are 12 or 13.

date

The first day of the last month of the Fiscal Year. This is not editable, it is generated by the FiscalYear when saved, using the end_month and year values.

save(*args, **kwargs)[source]

The FiscalYear save method will generate the date object for the date attribute.

fiscalyears Module

fiscalyears.fiscalyears.get_start_of_current_fiscal_year()[source]

Determine the Start Date of the Latest FiscalYear.

If there are no FiscalYears then this method will return None.

If there is one FiscalYear then the starting date will be the period amount of months before it’s date.

If there are multiple FiscalYears then the first day and month after the Second Latest FiscalYear will be returned.

Returns:The starting date of the current FiscalYear.
Return type:datetime.date or None

forms Module

class fiscalyears.forms.FiscalYearAccountsForm(*args, **kwargs)[source]

This form is used to select whether to exclude an account from the Transaction purging caused by the add_fiscal_year() view. Selected Accounts will retain their unreconciled Transactions.

This form is used by the modelformset_factory() to create the FiscalYearAccountsFormSet.

See also

View add_fiscal_year()
This view processes all actions required for starting a New Fiscal Year.
fiscalyears.forms.FiscalYearAccountsFormSet

An FormSet of Accounts using the FiscalYearAccountsForm as the base form.

alias of AccountFormFormSet

class fiscalyears.forms.FiscalYearForm(*args, **kwargs)[source]

This form is used to create new Fiscal Years.

The form validates the period length against the new Fiscal Year’s End Month and Year. To pass validation, the new Year must be greater than any previous years and the end Month must create a period less than or equal to the selected Period.

See also

View add_fiscal_year()
The add_fiscal_year() view processes all actions required for starting a New Fiscal Year.
Form FiscalYearAccountsForm
This form allows selection of the accounts to exclude in the New Fiscal Year’s Transaction purging.
clean()[source]

Validates that certain Accounts exist and that the entered Year is in the allowed range.

Validates that no previous year’s ending month is within the entered Period with respect to the entered end_month.

If the form causes a period change from 13 to 12 months, the method will ensure that there are no Transactions in the 13th month of the last FiscalYear.

If there are previous FiscalYears the method will make sure there are both a Current Year Earnings and Retained Earnings Equity Accounts with a type of 3.

clean_year()[source]

Validates that the entered Year value.

The value is required to be greater than or equal to any previously entered Year.

views Module

fiscalyears.views.add_fiscal_year(request, *args, **kwargs)[source]

Creates a new FiscalYear using a FiscalYearForm and FiscalYearAccountsFormSet.

Starting a new FiscalYear involves the following procedure:

  1. Setting a period and Ending month and year for the New Fiscal Year.
  2. Selecting Accounts to exclude from purging of unreconciled Transactions.
  3. Create a HistoricalAccount for every Account and month in the previous FiscalYear, using ending balances for Asset, Liability and Equity Accounts and balance changes for the others.
  4. Delete all Journal Entries, except those with unreconciled Transactions with Accounts in the exclude lists.
  5. Move the balance of the Current Year Earnings Account into the Retained Earnings Account.
  6. Zero the balance of all Income, Cost of Sales, Expense, Other Income and Other Expense Accounts.
Parameters:template_name (string) – The template to use.
Returns:HTTP response containing FiscalYearForm and FiscalYearAccountsFormSet as context. Redirects if successful POST is sent.
Return type:HttpResponse or HttpResponseRedirect