init defaults completed
This commit is contained in:
@@ -194,14 +194,14 @@ class Companies(CrudCollection, SelectAction):
|
||||
parent_id = mapped_column(Integer, nullable=True)
|
||||
workplace_no: Mapped[str] = mapped_column(String, nullable=True)
|
||||
|
||||
official_address_id: Mapped[int] = mapped_column(ForeignKey("addresses.id"))
|
||||
official_address_uu_id = mapped_column(
|
||||
official_address_id: Mapped[int] = mapped_column(ForeignKey("addresses.id"), nullable=True)
|
||||
official_address_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Official Address UUID"
|
||||
)
|
||||
top_responsible_company_id = mapped_column(
|
||||
top_responsible_company_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("companies.id"), nullable=True
|
||||
)
|
||||
top_responsible_company_uu_id = mapped_column(
|
||||
top_responsible_company_uu_id: Mapped[str] = mapped_column(
|
||||
String, nullable=True, comment="Top Responsible Company UUID"
|
||||
)
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user