Automatically manages created and modified timestamps. Provided by django-extensions.
Groups common attributes for accountable objects. These are the type of accounting (by effort / lump-sum), the status, the estimated costs and the budgeted hours.
Groups common attributes for projects with a certain activity period.
The main application user or company employee. Provided by django.contrib.auth.
... and some more
Inherits from TSM.
An extension to User that adds sandglass-specific user properties to the User model.
Counter for account locking after n failed logins. [int]
The number of failed login attempts that locks an account can be specified in a global configuration variable.
Reference to Teams including this user. [M2M]
Note
This is different from User.groups (to django.contrib.auth.models.Group) which is for grouping permissions. Teams are solely for grouping users.
Basic contact info like
Note
Currently only add the fields we need. Maybe extend the model later in a flexible way using an entity-attribute-value model.
Inherits from TSM.
Group of users/employees in terms of workgroup or department, not permissions.
Note
Might better be replaced by django.contrib.auth.models.Group.
Inherits from TSM.
Defines a set of „rules” the work-time of employees. TimeModels can be reused for multiple users and should be defined by administrators.
Hours the employee should do daily. The standard workday.
If daily hours should be defined on a daily basis, set daily_hours=None and use daily_hours_<weekday> instead.
Defaults to weekly_hours ÷ workdays_per_week. [float/time?]
E.g. 38.5 hours per week ÷ 5 workdays = 7.7 hours per day.
Daily hours for weekday (mon-sun) if defined on daily basis.
Defaults to None. [float/time?]
Hours an employee should do weekly. The standard work-week.
Should be the product of workdays_per_week × daily_hours or the sum of all daily_hours_<weekday> values. [float/time?]
The number of vacation days the employee may consume per year. [int]
In combination with all Activity entryies for the user, activity_type == vacation, and the entry date ( UserProfile.date_entry), this can be used to calculate the employee’s vacation quota for any date (without using the TimeSheet savepoints).
Example: the user has 25 days per year of vacation and started working for the company on the 17th of April 2011.
The vacation quota for the first year is calculated like this:
import calendar
import datetime
yearly_vacation = 25
entry_date = datetime.date(2011, 4, 17)
# vacation quota for year of entry
day_of_year = entry_date.timetuple().tm_yday # 107
days_in_year = 366 if calendar.isleap(entry_date.year) else 365 # 365
entry_quota = int(round(yearly_vacation * day_of_year / days_in_year))
# 7 days vacation in the first year
Then, let’s say the vacation history evolved that way (not taking weekends into account):
So, the current quota for 2012-06-24 is 7 - 5 + 25 - 1 - 15 == 11.
Generically, for any date, the current vacation quota calcuates as:
# number of years between date_entry and date
date = datetime.date(2012, 6, 24)
nr_years = date.year - entry_date.year # 1
# nr of days added to the quota in the meanwhile
quota_add = nr_years * yearly_vacation # 25
# consumed days from Activity, type == vacation before date
quota_sub = Activity.objects.filter(
user__pk=id,
activity_type='vacation',
end__lte=date).count() # e.g. 21
# current vacation quota
vacation_quota = entry_quota + quota_add - quota_sub # 11
Length of the usual interval in which the employee should do settlements. [choice]
One of weekly, bi-weekly, monthly, quarter-yearly, half-yearly, yearly.
Begin of the time-range an employee should start his/her workday at. [time]
If workday start-times should be defined on a daily basis, set day_start_from and day_start_to to None and use day_start_<weekday>_<from/to> instead.
Inherits from TSM.
Client (company or person) of the company comissioning at least one project. This does not link to a
Inherits from TSM.
Generic set of contact information of a person working for a client in general or on a specific project.
Further contact information
- additional phone numbers
- additional email addresses
- address
- room number
- department, position
Note
Currently only add the fields we need. Maybe extend the model later in a flexible way using an entity-attribute-value model.
Defines one project for a ceratain client (or internal, for the company itsself), that defines a list of tasks (project parts) available to book hours to.
Projects can be cloned to easily create new projects with the same attributes.
Reference to the contracting Client. [FK]
If no client is defined, the project is company-internal.
Main activity categorization for projects. Describes project phases, parts and areas.
Inherits from TSM.
A record of activity. This is the main unit of measure for sandglass. Activities can describe either work on a project, unassigned time, breaks or days where employees are away sick or on vacation.
Indicator of the kind of activity described. [enum] Can be one of:
Duration of the activity in days. [int]
Denormalized difference between end and start for faster retrieval of the number of days this activity must be accounted for. Must be updated in Activity.save.
Flag indicating if this activity has already been reviewed in some report. [boolean]
Note
Potential problem with project-time settlement reports (for invoicing) and employees’ monthly timesheets (for payroll accounting). We might need different lock states here.
Inherits from TSM.
Indicator of the kind of tag. [enum] Can be one of:
activity
Tagging for activities regarding the type of activity. Examples are design, development, templating, frontend, testing, consulting, presentation, coordination, meetings, ...
accounting
Tagging for activities regarding the price of the activity. Examples are editorial work, development, senior consulting, ...
time
Tagging for activities regarding the type of time the activity was carried out at. Examples are normal work-time, overtime, business trips, assembling, ...
Inherits from TSM.
A record of overtime. This is an additional tracking unit, next to Activity, which is used to keep track of employees’ overtime budget.
OverTime, not to be confused with the employees’ flexible working hours balance, needs to be kept track of manually.
For time-models with flexible working hours, the daily, weekly or monthly balance can easily be calculated for any date by summing the hours done in the period and balancing that with the daily_hours, weekly_hours or daily_hours × days_in_month (defined in the employee’s time-model) respectively.
OverTime, on the other hand, is subject to legal constraints and contractual agreements. As such, there is no generically valid way of determining if any given activity is to be seen as overtime or not.
By analyzing the employee’s time-model, sandglass will try to suggest overtime periods which the user can accept or refuse.
Employees can also consume overtime by requesting payout in their montly timesheets or manually compensating their flexible working hours balance.
Percentual additional value of the overtime hours. [float/decimal]
Usual values would be 0.5 (50%, 1:1,5) or 1 (100%, 1:2).
Length of overtime period. [timedelta]
Negative values can be provided as a matter of consuming ones overtime budget.
Inherits from TSM.
Montly (or weekly, bi-weekly, ...) settlement of the users’ activities. This acts as basis for salary calculations and as savepoint of the users’ status.
The employees’ vacation budget, flexible working-hours balance, overtime budget and the like are stored here and thus the development of those values in time is easily reproducable.
Any calculations should always use the last verified timesheet of a user as basis.
Title of the timesheet. [string]
Will be something like “Montly timesheet, January 2012, Name”.
The employee’s vacation budget from now on. [int]
This value is valid for the period after the TimeSheet.
The employee’s flextime budget from now on. [timedelta]
If the employee does not have a flextime model, this is optional.
This value is valid for the period after the TimeSheet.
The employee’s overtime budget from now on. [timedelta]
This value is valid for the period after the TimeSheet.
Inherits from TSM.
Saved filter configuration (user, team, client, project, ...) for generating a custom report.
Inherits from TSM.
Serialized report data stored for archiving purposes. No whatsoever connection to live data is kept in the snapshots. All required data is serialized so that changes don’t affect the report output.
Inherits from TSM.
Combination of ReportQuery and ReportSnapshot for reports which need to be verified by a supervisor.
Synchronization storage for ical feeds providing public holiday data.
Inherits from TSM.
Everyone likes other colors best. So let’s make some themes!