feat(human_resources): Change model to inherit from CenturionModel for Employee model

ref: #839 #843
This commit is contained in:
2025-06-19 22:25:14 +09:30
parent c5f8412d46
commit 23832fff6a
3 changed files with 85 additions and 7 deletions

View File

@ -0,0 +1,81 @@
# Generated by Django 5.1.9 on 2025-06-17 07:32
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0033_alter_ticketcommentcategory_parent_and_more"),
("human_resources", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="EmployeeAuditHistory",
fields=[
(
"centurionaudit_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="core.centurionaudit",
),
),
(
"model",
models.ForeignKey(
help_text="Model this history belongs to",
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="human_resources.employee",
verbose_name="Model",
),
),
],
options={
"verbose_name": "Employee History",
"verbose_name_plural": "Employee Histories",
"db_table": "human_resources_employee_audithistory",
"managed": True,
},
bases=("core.centurionaudit",),
),
migrations.CreateModel(
name="EmployeeCenturionModelNote",
fields=[
(
"centurionmodelnote_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="core.centurionmodelnote",
),
),
(
"model",
models.ForeignKey(
help_text="Model this note belongs to",
on_delete=django.db.models.deletion.CASCADE,
related_name="+",
to="human_resources.employee",
verbose_name="Model",
),
),
],
options={
"verbose_name": "Employee Note",
"verbose_name_plural": "Employee Notes",
"db_table": "human_resources_employee_centurionmodelnote",
"managed": True,
},
bases=("core.centurionmodelnote",),
),
]

View File

@ -8,6 +8,10 @@ class Employee(
Contact
):
documentation = ''
_is_submodel = True
class Meta:
@ -35,12 +39,6 @@ class Employee(
return self.f_name + ' ' + self.l_name
documentation = ''
history_app_label = 'human_resources'
history_model_name = 'employee'
page_layout: list = [
{
"name": "Details",

View File

@ -47,7 +47,6 @@ class ModelSerializer(
'email',
'directory',
'model_notes',
'is_global',
'created',
'modified',
'_urls',