init defaults completed

This commit is contained in:
2024-11-10 20:14:13 +03:00
parent aeda315119
commit c42a19c262
37 changed files with 582 additions and 308 deletions

View File

@@ -90,6 +90,7 @@ class Duties(CrudCollection):
active_row = dict(
is_confirmed=True, active=True, deleted=False, is_notification_send=True
)
list_of_created = []
execution = Departments.find_or_create(
department_name="Execution Office",
@@ -98,6 +99,7 @@ class Duties(CrudCollection):
company_uu_id=str(company_uu_id),
**active_row,
)
list_of_created.append(execution)
it_dept = Departments.find_or_create(
department_name="IT Department",
department_code="ITD001",
@@ -105,39 +107,46 @@ class Duties(CrudCollection):
company_uu_id=str(company_uu_id),
**active_row,
)
list_of_created.append(it_dept)
bm_duty = Duty.find_or_create(
duty_name="Business Manager",
duty_code="BM0001",
duty_description="Business Manager",
**active_row,
)
list_of_created.append(bm_duty)
it_duty = Duty.find_or_create(
duty_name="IT Manager",
duty_code="IT0001",
duty_description="IT Manager",
**active_row,
)
list_of_created.append(it_duty)
bulk_duty = Duty.find_or_create(
duty_name="BULK",
duty_code="BULK",
duty_description="BULK RECORDS OF THE COMPANY",
**active_row,
)
list_of_created.append(bulk_duty)
occu_duty = Duty.find_or_create(
duty_name="OCCUPANT",
duty_code="OCCUPANT",
duty_description="OCCUPANT RECORDS OF THE COMPANY",
**active_row,
)
cls.find_or_create(
list_of_created.append(occu_duty)
duties_created_bm = cls.find_or_create(
company_id=company_id,
company_uu_id=str(company_uu_id),
duties_id=bm_duty.id,
duties_uu_id=str(bm_duty.uu_id),
department_id=execution.id,
department_uu_id=str(execution.uu_id),
**active_row,
)
cls.find_or_create(
list_of_created.append(duties_created_bm)
duties_created_it = cls.find_or_create(
company_id=company_id,
company_uu_id=str(company_uu_id),
duties_id=it_duty.id,
@@ -146,7 +155,8 @@ class Duties(CrudCollection):
department_uu_id=str(it_dept.uu_id),
**active_row,
)
cls.find_or_create(
list_of_created.append(duties_created_it)
duties_created__ex = cls.find_or_create(
company_id=company_id,
company_uu_id=str(company_uu_id),
duties_id=bulk_duty.id,
@@ -155,7 +165,8 @@ class Duties(CrudCollection):
department_uu_id=str(execution.uu_id),
**active_row,
)
cls.find_or_create(
list_of_created.append(duties_created__ex)
duties_created_at = cls.find_or_create(
company_id=company_id,
company_uu_id=str(company_uu_id),
duties_id=occu_duty.id,
@@ -164,6 +175,9 @@ class Duties(CrudCollection):
department_uu_id=str(execution.uu_id),
**active_row,
)
list_of_created.append(duties_created_at)
return list_of_created
@classmethod
def get_bulk_duties_of_a_company(cls, company_id):