Marwan Alwali 84c1fb798e update
2025-09-08 19:52:52 +03:00

1519 lines
55 KiB
Python

# Generated by Django 5.2.6 on 2025-09-08 07:28
import django.core.validators
import django.db.models.deletion
import uuid
from decimal import Decimal
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("core", "0001_initial"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="Department",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"department_id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
help_text="Unique department identifier",
unique=True,
),
),
(
"code",
models.CharField(
help_text="Department code (e.g., CARD, EMER, SURG)",
max_length=20,
),
),
("name", models.CharField(help_text="Department name", max_length=100)),
(
"description",
models.TextField(
blank=True, help_text="Department description", null=True
),
),
(
"department_type",
models.CharField(
choices=[
("CLINICAL", "Clinical"),
("ADMINISTRATIVE", "Administrative"),
("SUPPORT", "Support"),
("ANCILLARY", "Ancillary"),
("EXECUTIVE", "Executive"),
],
help_text="Department type",
max_length=20,
),
),
(
"phone",
models.CharField(
blank=True,
help_text="Department phone number",
max_length=20,
null=True,
),
),
(
"extension",
models.CharField(
blank=True,
help_text="Phone extension",
max_length=10,
null=True,
),
),
(
"email",
models.EmailField(
blank=True,
help_text="Department email",
max_length=254,
null=True,
),
),
(
"annual_budget",
models.DecimalField(
blank=True,
decimal_places=2,
help_text="Annual budget",
max_digits=12,
null=True,
),
),
(
"cost_center",
models.CharField(
blank=True,
help_text="Cost center code",
max_length=20,
null=True,
),
),
(
"authorized_positions",
models.PositiveIntegerField(
default=0, help_text="Number of authorized positions"
),
),
(
"location",
models.CharField(
blank=True,
help_text="Department location",
max_length=100,
null=True,
),
),
(
"is_active",
models.BooleanField(default=True, help_text="Department is active"),
),
(
"is_24_hour",
models.BooleanField(
default=False, help_text="Department operates 24 hours"
),
),
(
"operating_hours",
models.JSONField(
blank=True,
default=dict,
help_text="Operating hours by day of week",
),
),
(
"accreditation_required",
models.BooleanField(
default=False,
help_text="Department requires special accreditation",
),
),
(
"accreditation_body",
models.CharField(
blank=True,
help_text="Accrediting body (e.g., Joint Commission, CAP)",
max_length=100,
null=True,
),
),
(
"last_inspection_date",
models.DateField(
blank=True, help_text="Last inspection date", null=True
),
),
(
"next_inspection_date",
models.DateField(
blank=True,
help_text="Next scheduled inspection date",
null=True,
),
),
(
"notes",
models.TextField(
blank=True, help_text="Department notes", null=True
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"created_by",
models.ForeignKey(
blank=True,
help_text="User who created the department",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="created_hr_departments",
to=settings.AUTH_USER_MODEL,
),
),
(
"parent_department",
models.ForeignKey(
blank=True,
help_text="Parent department",
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="sub_departments",
to="hr.department",
),
),
(
"tenant",
models.ForeignKey(
help_text="Organization tenant",
on_delete=django.db.models.deletion.CASCADE,
related_name="departments",
to="core.tenant",
),
),
],
options={
"verbose_name": "Department",
"verbose_name_plural": "Departments",
"db_table": "hr_department",
"ordering": ["name"],
},
),
migrations.CreateModel(
name="Employee",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"employee_id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
help_text="Unique employee identifier",
unique=True,
),
),
(
"employee_number",
models.CharField(help_text="Employee number", max_length=20),
),
("first_name", models.CharField(help_text="First name", max_length=50)),
("last_name", models.CharField(help_text="Last name", max_length=50)),
(
"middle_name",
models.CharField(
blank=True, help_text="Middle name", max_length=50, null=True
),
),
(
"preferred_name",
models.CharField(
blank=True, help_text="Preferred name", max_length=50, null=True
),
),
(
"email",
models.EmailField(
blank=True, help_text="Email address", max_length=254, null=True
),
),
(
"phone",
models.CharField(
blank=True, help_text="Phone number", max_length=20, null=True
),
),
(
"mobile_phone",
models.CharField(
blank=True,
help_text="Mobile phone number",
max_length=20,
null=True,
),
),
(
"address_line_1",
models.CharField(
blank=True,
help_text="Address line 1",
max_length=100,
null=True,
),
),
(
"address_line_2",
models.CharField(
blank=True,
help_text="Address line 2",
max_length=100,
null=True,
),
),
(
"city",
models.CharField(
blank=True, help_text="City", max_length=50, null=True
),
),
(
"state",
models.CharField(
blank=True, help_text="State/Province", max_length=50, null=True
),
),
(
"postal_code",
models.CharField(
blank=True,
help_text="Postal/ZIP code",
max_length=20,
null=True,
),
),
(
"country",
models.CharField(
blank=True, help_text="Country", max_length=50, null=True
),
),
(
"national_id",
models.CharField(
blank=True,
help_text="National ID",
max_length=10,
null=True,
unique=True,
),
),
(
"date_of_birth",
models.DateField(blank=True, help_text="Date of birth", null=True),
),
(
"gender",
models.CharField(
blank=True,
choices=[
("MALE", "Male"),
("FEMALE", "Female"),
("OTHER", "Other"),
("UNKNOWN", "Unknown"),
],
help_text="Gender",
max_length=10,
null=True,
),
),
(
"marital_status",
models.CharField(
blank=True,
choices=[
("SINGLE", "Single"),
("MARRIED", "Married"),
("DIVORCED", "Divorced"),
("WIDOWED", "Widowed"),
("SEPARATED", "Separated"),
("OTHER", "Other"),
],
help_text="Marital status",
max_length=20,
null=True,
),
),
("job_title", models.CharField(help_text="Job title", max_length=100)),
(
"employment_type",
models.CharField(
choices=[
("FULL_TIME", "Full Time"),
("PART_TIME", "Part Time"),
("CONTRACT", "Contract"),
("TEMPORARY", "Temporary"),
("INTERN", "Intern"),
("VOLUNTEER", "Volunteer"),
("PER_DIEM", "Per Diem"),
("CONSULTANT", "Consultant"),
],
help_text="Employment type",
max_length=20,
),
),
(
"employment_status",
models.CharField(
choices=[
("ACTIVE", "Active"),
("INACTIVE", "Inactive"),
("TERMINATED", "Terminated"),
("SUSPENDED", "Suspended"),
("LEAVE", "On Leave"),
("RETIRED", "Retired"),
],
default="ACTIVE",
help_text="Employment status",
max_length=20,
),
),
("hire_date", models.DateField(help_text="Hire date")),
(
"termination_date",
models.DateField(
blank=True, help_text="Termination date", null=True
),
),
(
"standard_hours_per_week",
models.DecimalField(
decimal_places=2,
default=Decimal("40.00"),
help_text="Standard hours per week",
max_digits=5,
),
),
(
"fte_percentage",
models.DecimalField(
decimal_places=2,
default=Decimal("100.00"),
help_text="FTE percentage",
max_digits=5,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(100),
],
),
),
(
"hourly_rate",
models.DecimalField(
blank=True,
decimal_places=2,
help_text="Hourly rate",
max_digits=10,
null=True,
),
),
(
"annual_salary",
models.DecimalField(
blank=True,
decimal_places=2,
help_text="Annual salary",
max_digits=12,
null=True,
),
),
(
"license_number",
models.CharField(
blank=True,
help_text="Professional license number",
max_length=50,
null=True,
),
),
(
"license_expiry_date",
models.DateField(
blank=True, help_text="License expiry date", null=True
),
),
(
"certifications",
models.JSONField(
default=list, help_text="Professional certifications"
),
),
(
"emergency_contact_name",
models.CharField(
blank=True,
help_text="Emergency contact name",
max_length=100,
null=True,
),
),
(
"emergency_contact_relationship",
models.CharField(
blank=True,
help_text="Emergency contact relationship",
max_length=50,
null=True,
),
),
(
"emergency_contact_phone",
models.CharField(
blank=True,
help_text="Emergency contact phone",
max_length=20,
null=True,
),
),
(
"notes",
models.TextField(blank=True, help_text="Employee notes", null=True),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"created_by",
models.ForeignKey(
blank=True,
help_text="User who created the employee record",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="created_employees",
to=settings.AUTH_USER_MODEL,
),
),
(
"department",
models.ForeignKey(
blank=True,
help_text="Department",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="employees",
to="hr.department",
),
),
(
"supervisor",
models.ForeignKey(
blank=True,
help_text="Direct supervisor",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="direct_reports",
to="hr.employee",
),
),
(
"tenant",
models.ForeignKey(
help_text="Organization tenant",
on_delete=django.db.models.deletion.CASCADE,
related_name="employees",
to="core.tenant",
),
),
(
"user",
models.OneToOneField(
blank=True,
help_text="Associated user account",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="employee_profile",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"verbose_name": "Employee",
"verbose_name_plural": "Employees",
"db_table": "hr_employee",
"ordering": ["last_name", "first_name"],
},
),
migrations.AddField(
model_name="department",
name="department_head",
field=models.ForeignKey(
blank=True,
help_text="Department head",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="headed_departments",
to="hr.employee",
),
),
migrations.CreateModel(
name="PerformanceReview",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"review_id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
help_text="Unique review identifier",
unique=True,
),
),
(
"review_period_start",
models.DateField(help_text="Review period start date"),
),
(
"review_period_end",
models.DateField(help_text="Review period end date"),
),
("review_date", models.DateField(help_text="Review date")),
(
"review_type",
models.CharField(
choices=[
("ANNUAL", "Annual Review"),
("PROBATIONARY", "Probationary Review"),
("MID_YEAR", "Mid-Year Review"),
("PROJECT", "Project Review"),
("DISCIPLINARY", "Disciplinary Review"),
("PROMOTION", "Promotion Review"),
],
help_text="Review type",
max_length=20,
),
),
(
"overall_rating",
models.DecimalField(
decimal_places=1,
help_text="Overall rating (1-5)",
max_digits=3,
validators=[
django.core.validators.MinValueValidator(1),
django.core.validators.MaxValueValidator(5),
],
),
),
(
"competency_ratings",
models.JSONField(
default=dict, help_text="Individual competency ratings"
),
),
(
"goals_achieved",
models.TextField(
blank=True,
help_text="Goals achieved during review period",
null=True,
),
),
(
"goals_not_achieved",
models.TextField(
blank=True,
help_text="Goals not achieved during review period",
null=True,
),
),
(
"future_goals",
models.TextField(
blank=True, help_text="Goals for next review period", null=True
),
),
(
"strengths",
models.TextField(
blank=True, help_text="Employee strengths", null=True
),
),
(
"areas_for_improvement",
models.TextField(
blank=True, help_text="Areas for improvement", null=True
),
),
(
"development_plan",
models.TextField(
blank=True, help_text="Professional development plan", null=True
),
),
(
"training_recommendations",
models.TextField(
blank=True, help_text="Training recommendations", null=True
),
),
(
"employee_comments",
models.TextField(
blank=True, help_text="Employee comments", null=True
),
),
(
"employee_signature_date",
models.DateField(
blank=True, help_text="Employee signature date", null=True
),
),
(
"status",
models.CharField(
choices=[
("DRAFT", "Draft"),
("IN_PROGRESS", "In Progress"),
("COMPLETED", "Completed"),
("ACKNOWLEDGED", "Acknowledged by Employee"),
("DISPUTED", "Disputed"),
],
default="DRAFT",
help_text="Review status",
max_length=20,
),
),
(
"notes",
models.TextField(
blank=True, help_text="Additional notes", null=True
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"employee",
models.ForeignKey(
help_text="Employee being reviewed",
on_delete=django.db.models.deletion.CASCADE,
related_name="performance_reviews",
to="hr.employee",
),
),
(
"reviewer",
models.ForeignKey(
blank=True,
help_text="Reviewer",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="conducted_reviews",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"verbose_name": "Performance Review",
"verbose_name_plural": "Performance Reviews",
"db_table": "hr_performance_review",
"ordering": ["-review_date"],
},
),
migrations.CreateModel(
name="Schedule",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"schedule_id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
help_text="Unique schedule identifier",
unique=True,
),
),
("name", models.CharField(help_text="Schedule name", max_length=100)),
(
"description",
models.TextField(
blank=True, help_text="Schedule description", null=True
),
),
(
"schedule_type",
models.CharField(
choices=[
("REGULAR", "Regular Schedule"),
("ROTATING", "Rotating Schedule"),
("FLEXIBLE", "Flexible Schedule"),
("ON_CALL", "On-Call Schedule"),
("TEMPORARY", "Temporary Schedule"),
],
help_text="Schedule type",
max_length=20,
),
),
("effective_date", models.DateField(help_text="Effective date")),
(
"end_date",
models.DateField(blank=True, help_text="End date", null=True),
),
(
"schedule_pattern",
models.JSONField(
default=dict, help_text="Schedule pattern configuration"
),
),
(
"is_active",
models.BooleanField(default=True, help_text="Schedule is active"),
),
(
"approval_date",
models.DateTimeField(
blank=True, help_text="Approval date and time", null=True
),
),
(
"notes",
models.TextField(blank=True, help_text="Schedule notes", null=True),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"approved_by",
models.ForeignKey(
blank=True,
help_text="User who approved the schedule",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="approved_schedules",
to=settings.AUTH_USER_MODEL,
),
),
(
"created_by",
models.ForeignKey(
blank=True,
help_text="User who created the schedule",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="created_schedules",
to=settings.AUTH_USER_MODEL,
),
),
(
"employee",
models.ForeignKey(
help_text="Employee",
on_delete=django.db.models.deletion.CASCADE,
related_name="schedules",
to="hr.employee",
),
),
],
options={
"verbose_name": "Schedule",
"verbose_name_plural": "Schedules",
"db_table": "hr_schedule",
"ordering": ["-effective_date"],
},
),
migrations.CreateModel(
name="ScheduleAssignment",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"assignment_id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
help_text="Unique assignment identifier",
unique=True,
),
),
("assignment_date", models.DateField(help_text="Assignment date")),
("start_time", models.TimeField(help_text="Start time")),
("end_time", models.TimeField(help_text="End time")),
(
"shift_type",
models.CharField(
choices=[
("DAY", "Day Shift"),
("EVENING", "Evening Shift"),
("NIGHT", "Night Shift"),
("WEEKEND", "Weekend Shift"),
("HOLIDAY", "Holiday Shift"),
("ON_CALL", "On-Call"),
("OVERTIME", "Overtime"),
],
help_text="Shift type",
max_length=20,
),
),
(
"location",
models.CharField(
blank=True,
help_text="Specific location",
max_length=100,
null=True,
),
),
(
"status",
models.CharField(
choices=[
("SCHEDULED", "Scheduled"),
("CONFIRMED", "Confirmed"),
("COMPLETED", "Completed"),
("CANCELLED", "Cancelled"),
("NO_SHOW", "No Show"),
],
default="SCHEDULED",
help_text="Assignment status",
max_length=20,
),
),
(
"break_minutes",
models.PositiveIntegerField(
default=0, help_text="Break time in minutes"
),
),
(
"lunch_minutes",
models.PositiveIntegerField(
default=0, help_text="Lunch time in minutes"
),
),
(
"notes",
models.TextField(
blank=True, help_text="Assignment notes", null=True
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"department",
models.ForeignKey(
blank=True,
help_text="Department",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="schedule_assignments",
to="hr.department",
),
),
(
"schedule",
models.ForeignKey(
help_text="Schedule",
on_delete=django.db.models.deletion.CASCADE,
related_name="assignments",
to="hr.schedule",
),
),
],
options={
"verbose_name": "Schedule Assignment",
"verbose_name_plural": "Schedule Assignments",
"db_table": "hr_schedule_assignment",
"ordering": ["assignment_date", "start_time"],
},
),
migrations.CreateModel(
name="TimeEntry",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"entry_id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
help_text="Unique time entry identifier",
unique=True,
),
),
("work_date", models.DateField(help_text="Work date")),
(
"clock_in_time",
models.DateTimeField(
blank=True, help_text="Clock in time", null=True
),
),
(
"clock_out_time",
models.DateTimeField(
blank=True, help_text="Clock out time", null=True
),
),
(
"break_start_time",
models.DateTimeField(
blank=True, help_text="Break start time", null=True
),
),
(
"break_end_time",
models.DateTimeField(
blank=True, help_text="Break end time", null=True
),
),
(
"lunch_start_time",
models.DateTimeField(
blank=True, help_text="Lunch start time", null=True
),
),
(
"lunch_end_time",
models.DateTimeField(
blank=True, help_text="Lunch end time", null=True
),
),
(
"regular_hours",
models.DecimalField(
decimal_places=2,
default=Decimal("0.00"),
help_text="Regular hours worked",
max_digits=5,
),
),
(
"overtime_hours",
models.DecimalField(
decimal_places=2,
default=Decimal("0.00"),
help_text="Overtime hours worked",
max_digits=5,
),
),
(
"total_hours",
models.DecimalField(
decimal_places=2,
default=Decimal("0.00"),
help_text="Total hours worked",
max_digits=5,
),
),
(
"entry_type",
models.CharField(
choices=[
("REGULAR", "Regular Time"),
("OVERTIME", "Overtime"),
("HOLIDAY", "Holiday"),
("VACATION", "Vacation"),
("SICK", "Sick Leave"),
("PERSONAL", "Personal Time"),
("BEREAVEMENT", "Bereavement"),
("JURY_DUTY", "Jury Duty"),
("TRAINING", "Training"),
],
default="REGULAR",
help_text="Entry type",
max_length=20,
),
),
(
"location",
models.CharField(
blank=True, help_text="Work location", max_length=100, null=True
),
),
(
"approval_date",
models.DateTimeField(
blank=True, help_text="Approval date and time", null=True
),
),
(
"status",
models.CharField(
choices=[
("DRAFT", "Draft"),
("SUBMITTED", "Submitted"),
("APPROVED", "Approved"),
("REJECTED", "Rejected"),
("PAID", "Paid"),
],
default="DRAFT",
help_text="Entry status",
max_length=20,
),
),
(
"notes",
models.TextField(
blank=True, help_text="Time entry notes", null=True
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"approved_by",
models.ForeignKey(
blank=True,
help_text="User who approved the time entry",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="approved_time_entries",
to=settings.AUTH_USER_MODEL,
),
),
(
"department",
models.ForeignKey(
blank=True,
help_text="Department",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="time_entries",
to="hr.department",
),
),
(
"employee",
models.ForeignKey(
help_text="Employee",
on_delete=django.db.models.deletion.CASCADE,
related_name="time_entries",
to="hr.employee",
),
),
],
options={
"verbose_name": "Time Entry",
"verbose_name_plural": "Time Entries",
"db_table": "hr_time_entry",
"ordering": ["-work_date"],
},
),
migrations.CreateModel(
name="TrainingRecord",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"record_id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
help_text="Unique training record identifier",
unique=True,
),
),
(
"training_name",
models.CharField(help_text="Training name", max_length=200),
),
(
"training_description",
models.TextField(
blank=True, help_text="Training description", null=True
),
),
(
"training_type",
models.CharField(
choices=[
("ORIENTATION", "Orientation"),
("MANDATORY", "Mandatory Training"),
("CONTINUING_ED", "Continuing Education"),
("CERTIFICATION", "Certification"),
("SKILLS", "Skills Training"),
("SAFETY", "Safety Training"),
("COMPLIANCE", "Compliance Training"),
("LEADERSHIP", "Leadership Development"),
("TECHNICAL", "Technical Training"),
("OTHER", "Other"),
],
help_text="Training type",
max_length=20,
),
),
(
"training_provider",
models.CharField(
blank=True,
help_text="Training provider",
max_length=200,
null=True,
),
),
(
"instructor",
models.CharField(
blank=True,
help_text="Instructor name",
max_length=100,
null=True,
),
),
("training_date", models.DateField(help_text="Training date")),
(
"completion_date",
models.DateField(
blank=True, help_text="Completion date", null=True
),
),
(
"expiry_date",
models.DateField(
blank=True, help_text="Certification expiry date", null=True
),
),
(
"duration_hours",
models.DecimalField(
decimal_places=2,
default=Decimal("0.00"),
help_text="Training duration in hours",
max_digits=5,
),
),
(
"credits_earned",
models.DecimalField(
decimal_places=2,
default=Decimal("0.00"),
help_text="Credits earned",
max_digits=5,
),
),
(
"status",
models.CharField(
choices=[
("SCHEDULED", "Scheduled"),
("IN_PROGRESS", "In Progress"),
("COMPLETED", "Completed"),
("CANCELLED", "Cancelled"),
("NO_SHOW", "No Show"),
("FAILED", "Failed"),
],
default="SCHEDULED",
help_text="Training status",
max_length=20,
),
),
(
"score",
models.DecimalField(
blank=True,
decimal_places=2,
help_text="Training score/grade",
max_digits=5,
null=True,
),
),
(
"passed",
models.BooleanField(default=False, help_text="Training passed"),
),
(
"is_certified",
models.BooleanField(
default=False, help_text="Training is certified"
),
),
(
"certificate_number",
models.CharField(
blank=True,
help_text="Certificate number",
max_length=50,
null=True,
),
),
(
"certification_body",
models.CharField(
blank=True,
help_text="Certification body",
max_length=200,
null=True,
),
),
(
"training_cost",
models.DecimalField(
decimal_places=2,
default=Decimal("0.00"),
help_text="Training cost",
max_digits=10,
),
),
(
"notes",
models.TextField(blank=True, help_text="Training notes", null=True),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"created_by",
models.ForeignKey(
blank=True,
help_text="User who created the training record",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="created_training_records",
to=settings.AUTH_USER_MODEL,
),
),
(
"employee",
models.ForeignKey(
help_text="Employee",
on_delete=django.db.models.deletion.CASCADE,
related_name="training_records",
to="hr.employee",
),
),
],
options={
"verbose_name": "Training Record",
"verbose_name_plural": "Training Records",
"db_table": "hr_training_record",
"ordering": ["-training_date"],
},
),
migrations.AddIndex(
model_name="employee",
index=models.Index(
fields=["tenant", "employment_status"],
name="hr_employee_tenant__54b199_idx",
),
),
migrations.AddIndex(
model_name="employee",
index=models.Index(
fields=["employee_number"], name="hr_employee_employe_725225_idx"
),
),
migrations.AddIndex(
model_name="employee",
index=models.Index(
fields=["last_name", "first_name"],
name="hr_employee_last_na_dfcdea_idx",
),
),
migrations.AddIndex(
model_name="employee",
index=models.Index(
fields=["department"], name="hr_employee_departm_1b8ba9_idx"
),
),
migrations.AddIndex(
model_name="employee",
index=models.Index(
fields=["hire_date"], name="hr_employee_hire_da_4d71d0_idx"
),
),
migrations.AlterUniqueTogether(
name="employee",
unique_together={("tenant", "employee_number")},
),
migrations.AddIndex(
model_name="department",
index=models.Index(
fields=["tenant", "department_type"],
name="hr_departme_tenant__87fa85_idx",
),
),
migrations.AddIndex(
model_name="department",
index=models.Index(fields=["code"], name="hr_departme_code_d27daf_idx"),
),
migrations.AddIndex(
model_name="department",
index=models.Index(fields=["name"], name="hr_departme_name_00be75_idx"),
),
migrations.AddIndex(
model_name="department",
index=models.Index(
fields=["is_active"], name="hr_departme_is_acti_b443d7_idx"
),
),
migrations.AlterUniqueTogether(
name="department",
unique_together={("tenant", "code")},
),
migrations.AddIndex(
model_name="performancereview",
index=models.Index(
fields=["employee", "review_date"],
name="hr_performa_employe_604c29_idx",
),
),
migrations.AddIndex(
model_name="performancereview",
index=models.Index(
fields=["review_type"], name="hr_performa_review__a7c664_idx"
),
),
migrations.AddIndex(
model_name="performancereview",
index=models.Index(fields=["status"], name="hr_performa_status_460939_idx"),
),
migrations.AddIndex(
model_name="performancereview",
index=models.Index(
fields=["overall_rating"], name="hr_performa_overall_0257f6_idx"
),
),
migrations.AddIndex(
model_name="schedule",
index=models.Index(
fields=["employee", "effective_date"],
name="hr_schedule_employe_2bbf02_idx",
),
),
migrations.AddIndex(
model_name="schedule",
index=models.Index(
fields=["schedule_type"], name="hr_schedule_schedul_19e2a5_idx"
),
),
migrations.AddIndex(
model_name="schedule",
index=models.Index(
fields=["is_active"], name="hr_schedule_is_acti_2e906a_idx"
),
),
migrations.AddIndex(
model_name="scheduleassignment",
index=models.Index(
fields=["schedule", "assignment_date"],
name="hr_schedule_schedul_85a37e_idx",
),
),
migrations.AddIndex(
model_name="scheduleassignment",
index=models.Index(
fields=["assignment_date"], name="hr_schedule_assignm_cf8fba_idx"
),
),
migrations.AddIndex(
model_name="scheduleassignment",
index=models.Index(fields=["status"], name="hr_schedule_status_a9da0d_idx"),
),
migrations.AddIndex(
model_name="timeentry",
index=models.Index(
fields=["employee", "work_date"], name="hr_time_ent_employe_9f8566_idx"
),
),
migrations.AddIndex(
model_name="timeentry",
index=models.Index(
fields=["work_date"], name="hr_time_ent_work_da_898420_idx"
),
),
migrations.AddIndex(
model_name="timeentry",
index=models.Index(fields=["status"], name="hr_time_ent_status_c67efb_idx"),
),
migrations.AddIndex(
model_name="timeentry",
index=models.Index(
fields=["entry_type"], name="hr_time_ent_entry_t_eba769_idx"
),
),
migrations.AddIndex(
model_name="trainingrecord",
index=models.Index(
fields=["employee", "training_date"],
name="hr_training_employe_92e25f_idx",
),
),
migrations.AddIndex(
model_name="trainingrecord",
index=models.Index(
fields=["training_type"], name="hr_training_trainin_2ce7d6_idx"
),
),
migrations.AddIndex(
model_name="trainingrecord",
index=models.Index(fields=["status"], name="hr_training_status_8cd64b_idx"),
),
migrations.AddIndex(
model_name="trainingrecord",
index=models.Index(
fields=["expiry_date"], name="hr_training_expiry__f29707_idx"
),
),
]