event decision book item updated
This commit is contained in:
parent
295dbe2cd8
commit
58ee49a1fc
|
|
@ -117,7 +117,7 @@ class DecisionBookCreateEventMethods(MethodToEvent):
|
||||||
)
|
)
|
||||||
data_dict["expiry_starts"] = str(data_dict["expiry_starts"])
|
data_dict["expiry_starts"] = str(data_dict["expiry_starts"])
|
||||||
build_decision_book = BuildDecisionBook.find_or_create(**data_dict)
|
build_decision_book = BuildDecisionBook.find_or_create(**data_dict)
|
||||||
BuildDecisionBook.save()
|
build_decision_book.save_and_confirm()
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
content=dict(
|
content=dict(
|
||||||
|
|
|
||||||
|
|
@ -136,8 +136,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
local_date = system_arrow.find_last_day_of_month(local_date)
|
local_date = system_arrow.find_last_day_of_month(local_date)
|
||||||
payment_amount = unit_price
|
payment_amount = unit_price
|
||||||
if not unit_price_is_fixed:
|
if not unit_price_is_fixed:
|
||||||
unit_amount = str(build_part_single.due_part_key).replace(" ", "")
|
unit_amount = int(build_part_single.part_net_size)
|
||||||
unit_amount = unit_amount.replace(str(unit_type).upper(), "")
|
|
||||||
payment_amount = abs(unit_price * float(unit_amount)) * -1
|
payment_amount = abs(unit_price * float(unit_amount)) * -1
|
||||||
payment_amount = -1 * (
|
payment_amount = -1 * (
|
||||||
abs(payment_amount) + (50 - float(abs(payment_amount)) % 50)
|
abs(payment_amount) + (50 - float(abs(payment_amount)) % 50)
|
||||||
|
|
@ -179,6 +178,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
BuildParts.human_livable == True,
|
BuildParts.human_livable == True,
|
||||||
BuildParts.build_id == build_id,
|
BuildParts.build_id == build_id,
|
||||||
)
|
)
|
||||||
|
print('data_info_type.key', data_info_type.key)
|
||||||
book_payment_dict = dict(
|
book_payment_dict = dict(
|
||||||
payment_plan_time_periods=str(data_info_type.key),
|
payment_plan_time_periods=str(data_info_type.key),
|
||||||
build_decision_book_item_id=decision_book_item.id,
|
build_decision_book_item_id=decision_book_item.id,
|
||||||
|
|
@ -193,7 +193,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
end_date = system_arrow.get(
|
end_date = system_arrow.get(
|
||||||
system_arrow.get(decision_book.expiry_ends).date()
|
system_arrow.get(decision_book.expiry_ends).date()
|
||||||
)
|
)
|
||||||
cls.iterate_over_build_parts(
|
payment_return_dict = cls.iterate_over_build_parts(
|
||||||
build_parts_list=build_parts_list.data,
|
build_parts_list=build_parts_list.data,
|
||||||
payment_types=payment_types,
|
payment_types=payment_types,
|
||||||
local_date=local_date,
|
local_date=local_date,
|
||||||
|
|
@ -203,12 +203,11 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
unit_price_is_fixed=unit_price_is_fixed,
|
unit_price_is_fixed=unit_price_is_fixed,
|
||||||
book_payment_dict=book_payment_dict,
|
book_payment_dict=book_payment_dict,
|
||||||
)
|
)
|
||||||
BuildDecisionBookProjects.save()
|
return payment_return_dict
|
||||||
return
|
|
||||||
elif data_info_type.key == "BDT-A":
|
elif data_info_type.key == "BDT-A":
|
||||||
local_date = system_arrow.get(system_arrow.get(debit_start_date).date())
|
local_date = system_arrow.get(system_arrow.get(debit_start_date).date())
|
||||||
end_date = system_arrow.get(system_arrow.get(debit_end_date).date())
|
end_date = system_arrow.get(system_arrow.get(debit_end_date).date())
|
||||||
cls.iterate_over_build_parts(
|
payment_return_dict = cls.iterate_over_build_parts(
|
||||||
build_parts_list=build_parts_list.data,
|
build_parts_list=build_parts_list.data,
|
||||||
payment_types=payment_types,
|
payment_types=payment_types,
|
||||||
local_date=local_date,
|
local_date=local_date,
|
||||||
|
|
@ -218,8 +217,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
unit_price_is_fixed=unit_price_is_fixed,
|
unit_price_is_fixed=unit_price_is_fixed,
|
||||||
book_payment_dict=book_payment_dict,
|
book_payment_dict=book_payment_dict,
|
||||||
)
|
)
|
||||||
BuildDecisionBookProjects.save()
|
return payment_return_dict
|
||||||
return
|
|
||||||
elif data_info_type.key == "BDT-R" or data_info_type.key == "BDT-L":
|
elif data_info_type.key == "BDT-R" or data_info_type.key == "BDT-L":
|
||||||
local_date = system_arrow.get(system_arrow.get(debit_start_date).date())
|
local_date = system_arrow.get(system_arrow.get(debit_start_date).date())
|
||||||
end_date = system_arrow.get(system_arrow.get(debit_end_date).date())
|
end_date = system_arrow.get(system_arrow.get(debit_end_date).date())
|
||||||
|
|
@ -230,7 +228,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
BuildDecisionBookProjects.build_decision_book_id == decision_book.id,
|
BuildDecisionBookProjects.build_decision_book_id == decision_book.id,
|
||||||
BuildDecisionBookProjects.project_type
|
BuildDecisionBookProjects.project_type
|
||||||
== f"{decision_book.decision_type}_{data_info_type.key}",
|
== f"{decision_book.decision_type}_{data_info_type.key}",
|
||||||
).data
|
)
|
||||||
management_room = BuildParts.filter_one(
|
management_room = BuildParts.filter_one(
|
||||||
BuildParts.build_id == build_id,
|
BuildParts.build_id == build_id,
|
||||||
BuildParts.part_no == 0,
|
BuildParts.part_no == 0,
|
||||||
|
|
@ -242,13 +240,12 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
BuildLivingSpace.build_parts_id == management_room.id,
|
BuildLivingSpace.build_parts_id == management_room.id,
|
||||||
BuildLivingSpace.occupant_type == occupant_man.id,
|
BuildLivingSpace.occupant_type == occupant_man.id,
|
||||||
).data
|
).data
|
||||||
if not manager_living_space.data:
|
if not manager_living_space:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
detail=f"{occupant_man.occupant_description} Living Space is not found. Check manager living space and try again",
|
detail=f"{occupant_man.occupant_description} Living Space is not found. Check manager living space and try again",
|
||||||
)
|
)
|
||||||
already_book_project_count = already_book_projects.count + 1
|
already_book_project_count = already_book_projects.count + 1
|
||||||
manager_living_space = manager_living_space.get(1)
|
|
||||||
book_project_dict = dict(
|
book_project_dict = dict(
|
||||||
project_no=f"{data_info_type.key}_{decision_date.year}_{already_book_project_count}",
|
project_no=f"{data_info_type.key}_{decision_date.year}_{already_book_project_count}",
|
||||||
project_name=f"{str(meeting_date)}_{decision_book.decision_type} Project {already_book_projects.count + 1}",
|
project_name=f"{str(meeting_date)}_{decision_book.decision_type} Project {already_book_projects.count + 1}",
|
||||||
|
|
@ -266,10 +263,12 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
book_project_created = BuildDecisionBookProjects.find_or_create(
|
book_project_created = BuildDecisionBookProjects.find_or_create(
|
||||||
**book_project_dict
|
**book_project_dict
|
||||||
)
|
)
|
||||||
|
print('book_project_created', book_project_created)
|
||||||
decision_book_item.update(
|
decision_book_item.update(
|
||||||
item_comment=f"{book_project_created.project_no}_{book_project_created.project_name} "
|
item_comment=f"{book_project_created.project_no}_{book_project_created.project_name} "
|
||||||
f"is assigned to {occupant_man.occupant_description}"
|
f"is assigned to {occupant_man.occupant_description}"
|
||||||
)
|
)
|
||||||
|
decision_book_item.save_and_confirm()
|
||||||
project_lead = ApiEnumDropdown.filter_by_one(
|
project_lead = ApiEnumDropdown.filter_by_one(
|
||||||
system=True, key="PTT-LDR", enum_class="ProjectTeamTypes"
|
system=True, key="PTT-LDR", enum_class="ProjectTeamTypes"
|
||||||
).data
|
).data
|
||||||
|
|
@ -281,7 +280,7 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
project_team_type_id=project_lead.id,
|
project_team_type_id=project_lead.id,
|
||||||
project_team_type_uu_id=str(project_lead.uu_id),
|
project_team_type_uu_id=str(project_lead.uu_id),
|
||||||
)
|
)
|
||||||
BuildDecisionBookProjects.save()
|
project_person.save_and_confirm()
|
||||||
return book_project_created
|
return book_project_created
|
||||||
|
|
||||||
elif data_info_type.key == "BDT-S":
|
elif data_info_type.key == "BDT-S":
|
||||||
|
|
@ -325,18 +324,25 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
decision_book = BuildDecisionBook.filter_one(
|
decision_book = BuildDecisionBook.filter_one(
|
||||||
BuildDecisionBook.id == decision_book_person.build_decision_book_id,
|
BuildDecisionBook.id == decision_book_person.build_decision_book_id,
|
||||||
).data
|
).data
|
||||||
|
|
||||||
|
book_items = BuildDecisionBookItems.filter_all(
|
||||||
|
BuildDecisionBookItems.build_decision_book_id == decision_book.id,
|
||||||
|
system=True
|
||||||
|
)
|
||||||
|
if int(book_items.count) < 3:
|
||||||
BuildDecisionBookItems.check_meeting_is_valid_to_start_add_attendance(
|
BuildDecisionBookItems.check_meeting_is_valid_to_start_add_attendance(
|
||||||
decision_book=decision_book,
|
decision_book=decision_book,
|
||||||
token_dict=token_dict,
|
token_dict=token_dict,
|
||||||
)
|
)
|
||||||
|
|
||||||
book_items = BuildDecisionBookItems.filter_all(
|
book_items = BuildDecisionBookItems.filter_all(
|
||||||
BuildDecisionBookItems.build_decision_book_id == decision_book.id,
|
BuildDecisionBookItems.build_decision_book_id == decision_book.id,
|
||||||
|
system=True
|
||||||
)
|
)
|
||||||
|
|
||||||
data_dict["item_order"] = int(book_items.count) + 1
|
data_dict["item_order"] = int(book_items.count) + 1
|
||||||
data_dict["build_decision_book_id"] = decision_book.id
|
data_dict["build_decision_book_id"] = decision_book.id
|
||||||
data_dict["build_decision_book_uu_id"] = str(decision_book.uu_id)
|
data_dict["build_decision_book_uu_id"] = str(decision_book.uu_id)
|
||||||
data_dict["is_confirmed"] = True
|
|
||||||
|
|
||||||
data_info_type = ApiEnumDropdown.filter_by_one(
|
data_info_type = ApiEnumDropdown.filter_by_one(
|
||||||
system=True, enum_class="BuildDuesTypes", key="BDT-I",
|
system=True, enum_class="BuildDuesTypes", key="BDT-I",
|
||||||
|
|
@ -376,9 +382,9 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
data_dict["currency"],
|
data_dict["currency"],
|
||||||
)
|
)
|
||||||
|
|
||||||
new_decision_book_item = BuildDecisionBookItems.find_or_create(
|
new_decision_book_item = BuildDecisionBookItems.find_or_create(**data_dict)
|
||||||
**data_dict
|
new_decision_book_item.save_and_confirm()
|
||||||
)
|
print('new_decision_book_item', new_decision_book_item)
|
||||||
if created_payment_records_dict := cls.create_payment_records_for_each_build_part(
|
if created_payment_records_dict := cls.create_payment_records_for_each_build_part(
|
||||||
data_info_type=data_info_type,
|
data_info_type=data_info_type,
|
||||||
build_id=decision_book.build_id,
|
build_id=decision_book.build_id,
|
||||||
|
|
@ -407,6 +413,13 @@ class DecisionBookDecisionBookItemsCreateEventMethods(MethodToEvent):
|
||||||
item_comment = item_comment[:-2]
|
item_comment = item_comment[:-2]
|
||||||
new_decision_book_item.update(item_comment=item_comment)
|
new_decision_book_item.update(item_comment=item_comment)
|
||||||
new_decision_book_item.update(is_payment_created=True)
|
new_decision_book_item.update(is_payment_created=True)
|
||||||
|
elif row_is_project:
|
||||||
|
project_no = str(created_payment_records_dict.project_no)
|
||||||
|
item_comment = f"{data.item_comment} | @ Project is created no : {project_no}."
|
||||||
|
new_decision_book_item.update(item_comment=item_comment)
|
||||||
|
new_decision_book_item.update(is_payment_created=True)
|
||||||
|
new_decision_book_item.save_and_confirm()
|
||||||
|
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
status_code=status.HTTP_200_OK,
|
status_code=status.HTTP_200_OK,
|
||||||
content=dict(
|
content=dict(
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ class Build(CrudCollection, SelectActionWithEmployee):
|
||||||
def management_room(self):
|
def management_room(self):
|
||||||
if management_room := BuildParts.filter_by_one(
|
if management_room := BuildParts.filter_by_one(
|
||||||
system=True, id=self.management_room_id, build_id=self.id
|
system=True, id=self.management_room_id, build_id=self.id
|
||||||
):
|
).data:
|
||||||
return management_room
|
return management_room
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -566,7 +566,9 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
item_comment: Mapped[str] = mapped_column(
|
item_comment: Mapped[str] = mapped_column(
|
||||||
Text, nullable=False, comment="Comment Content"
|
Text, nullable=False, comment="Comment Content"
|
||||||
)
|
)
|
||||||
item_objection: Mapped[str] = mapped_column(Text)
|
item_objection: Mapped[str] = mapped_column(
|
||||||
|
Text, nullable=True, comment="Objection Content"
|
||||||
|
)
|
||||||
info_is_completed: Mapped[bool] = mapped_column(
|
info_is_completed: Mapped[bool] = mapped_column(
|
||||||
Boolean, server_default="0", comment="Info process is Completed"
|
Boolean, server_default="0", comment="Info process is Completed"
|
||||||
)
|
)
|
||||||
|
|
@ -599,6 +601,19 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
foreign_keys="BuildDecisionBookProjects.build_decision_book_item_id",
|
foreign_keys="BuildDecisionBookProjects.build_decision_book_item_id",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
__table_args__ = (
|
||||||
|
Index("_build_decision_book_item_ndx_01", build_decision_book_id),
|
||||||
|
Index(
|
||||||
|
"_build_decision_book_item_ndx_02",
|
||||||
|
build_decision_book_id,
|
||||||
|
item_order,
|
||||||
|
unique=True,
|
||||||
|
),
|
||||||
|
{
|
||||||
|
"comment": "Decision Book Items that are related to decision taken at building meetings"
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def select_action(cls, duty_id, token=None):
|
def select_action(cls, duty_id, token=None):
|
||||||
from databases import (
|
from databases import (
|
||||||
|
|
@ -668,7 +683,7 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
BuildDecisionBookInvitations.id == active_invite.id
|
BuildDecisionBookInvitations.id == active_invite.id
|
||||||
).data
|
).data
|
||||||
people_book_attend_count = None
|
people_book_attend_count = None
|
||||||
if invitation.invitation_attempt == 1:
|
if int(invitation.invitation_attempt) == 1:
|
||||||
people_book_attend_is_attending = BuildDecisionBookPerson.filter_all(
|
people_book_attend_is_attending = BuildDecisionBookPerson.filter_all(
|
||||||
BuildDecisionBookPerson.invite_id == invitation.id,
|
BuildDecisionBookPerson.invite_id == invitation.id,
|
||||||
BuildDecisionBookPerson.is_attending == True,
|
BuildDecisionBookPerson.is_attending == True,
|
||||||
|
|
@ -678,7 +693,7 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
[person.id for person in people_book_attend_is_attending.data]
|
[person.id for person in people_book_attend_is_attending.data]
|
||||||
),
|
),
|
||||||
BuildDecisionBookPersonOccupants.occupant_type_id.in_(
|
BuildDecisionBookPersonOccupants.occupant_type_id.in_(
|
||||||
[occupant_type.id for occupant_type in occupant_type_list.data]
|
[occupant_type.id for occupant_type in occupant_type_list]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
people_book_attend_count = people_book_attend.count
|
people_book_attend_count = people_book_attend.count
|
||||||
|
|
@ -719,7 +734,7 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
== person_occupants_pre.build_decision_book_person_id
|
== person_occupants_pre.build_decision_book_person_id
|
||||||
).data
|
).data
|
||||||
person = People.filter_one(People.id == person_invite_pret.person_id).data
|
person = People.filter_one(People.id == person_invite_pret.person_id).data
|
||||||
BuildDecisionBookItems.find_or_create(
|
created_attendance = BuildDecisionBookItems.find_or_create(
|
||||||
**book_items_dict,
|
**book_items_dict,
|
||||||
item_order=1,
|
item_order=1,
|
||||||
item_comment=comment(
|
item_comment=comment(
|
||||||
|
|
@ -728,6 +743,7 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
full_name=person.full_name,
|
full_name=person.full_name,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
created_attendance.save_and_confirm()
|
||||||
|
|
||||||
person_occupants_wrt = BuildDecisionBookPersonOccupants.filter_one(
|
person_occupants_wrt = BuildDecisionBookPersonOccupants.filter_one(
|
||||||
BuildDecisionBookPersonOccupants.invite_id == invitation.id,
|
BuildDecisionBookPersonOccupants.invite_id == invitation.id,
|
||||||
|
|
@ -738,7 +754,7 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
== person_occupants_wrt.build_decision_book_person_id
|
== person_occupants_wrt.build_decision_book_person_id
|
||||||
).data
|
).data
|
||||||
person = People.filter_one(People.id == person_invite_pret.person_id).data
|
person = People.filter_one(People.id == person_invite_pret.person_id).data
|
||||||
BuildDecisionBookItems.find_or_create(
|
created_attendance = BuildDecisionBookItems.find_or_create(
|
||||||
**book_items_dict,
|
**book_items_dict,
|
||||||
item_order=2,
|
item_order=2,
|
||||||
item_comment=comment(
|
item_comment=comment(
|
||||||
|
|
@ -747,6 +763,7 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
full_name=person.full_name,
|
full_name=person.full_name,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
created_attendance.save_and_confirm()
|
||||||
|
|
||||||
person_occupants_mng = BuildDecisionBookPersonOccupants.filter_one(
|
person_occupants_mng = BuildDecisionBookPersonOccupants.filter_one(
|
||||||
BuildDecisionBookPersonOccupants.invite_id == invitation.id,
|
BuildDecisionBookPersonOccupants.invite_id == invitation.id,
|
||||||
|
|
@ -757,7 +774,7 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
== person_occupants_mng.build_decision_book_person_id
|
== person_occupants_mng.build_decision_book_person_id
|
||||||
).data
|
).data
|
||||||
person = People.filter_one(People.id == person_invite_pret.person_id).data
|
person = People.filter_one(People.id == person_invite_pret.person_id).data
|
||||||
BuildDecisionBookItems.find_or_create(
|
created_attendance = BuildDecisionBookItems.find_or_create(
|
||||||
**book_items_dict,
|
**book_items_dict,
|
||||||
item_order=3,
|
item_order=3,
|
||||||
item_comment=comment(
|
item_comment=comment(
|
||||||
|
|
@ -766,20 +783,10 @@ class BuildDecisionBookItems(CrudCollection):
|
||||||
full_name=person.full_name,
|
full_name=person.full_name,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
created_attendance.save_and_confirm()
|
||||||
return people_book_attend_count
|
return people_book_attend_count
|
||||||
|
|
||||||
__table_args__ = (
|
|
||||||
Index("_build_decision_book_item_ndx_01", build_decision_book_id),
|
|
||||||
Index(
|
|
||||||
"_build_decision_book_item_ndx_02",
|
|
||||||
build_decision_book_id,
|
|
||||||
item_order,
|
|
||||||
unique=True,
|
|
||||||
),
|
|
||||||
{
|
|
||||||
"comment": "Decision Book Items that are related to decision taken at building meetings"
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class BuildDecisionBookItemsUnapproved(CrudCollection):
|
class BuildDecisionBookItemsUnapproved(CrudCollection):
|
||||||
|
|
@ -875,14 +882,14 @@ class BuildDecisionBookPayments(CrudCollection):
|
||||||
ForeignKey("build_parts.id"), nullable=False
|
ForeignKey("build_parts.id"), nullable=False
|
||||||
)
|
)
|
||||||
build_parts_uu_id: Mapped[str] = mapped_column(
|
build_parts_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Build Part UUID"
|
String, nullable=False, comment="Build Part UUID"
|
||||||
)
|
)
|
||||||
|
|
||||||
budget_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"))
|
budget_records_id: Mapped[int] = mapped_column(ForeignKey("account_records.id"), nullable=True)
|
||||||
budget_records_uu_id: Mapped[str] = mapped_column(
|
budget_records_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Budget UUID"
|
String, nullable=True, comment="Budget UUID"
|
||||||
)
|
)
|
||||||
accounting_id: Mapped[int] = mapped_column(ForeignKey("account_detail.id"))
|
accounting_id: Mapped[int] = mapped_column(ForeignKey("account_detail.id"), nullable=True)
|
||||||
accounting_uu_id: Mapped[str] = mapped_column(
|
accounting_uu_id: Mapped[str] = mapped_column(
|
||||||
String, nullable=True, comment="Accounting UUID"
|
String, nullable=True, comment="Accounting UUID"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -56,14 +56,14 @@ class FilterAttributes:
|
||||||
message=str(e.__context__).split("\n")[0],
|
message=str(e.__context__).split("\n")[0],
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
def save_and_confirm(self):
|
||||||
def save_and_confirm(cls):
|
|
||||||
"""Saves the updated model to the current entity db."""
|
"""Saves the updated model to the current entity db."""
|
||||||
try:
|
try:
|
||||||
cls.is_confirmed = True
|
self.save()
|
||||||
cls.__session__.commit()
|
self.update(is_confirmed=True)
|
||||||
|
self.save()
|
||||||
except SQLAlchemyError as e:
|
except SQLAlchemyError as e:
|
||||||
cls.raise_http_exception(
|
self.raise_http_exception(
|
||||||
status_code="HTTP_400_BAD_REQUEST",
|
status_code="HTTP_400_BAD_REQUEST",
|
||||||
error_case=e.__class__.__name__,
|
error_case=e.__class__.__name__,
|
||||||
data={},
|
data={},
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,14 @@ def init_api_enums_build_types():
|
||||||
type_name=insert_type["type_name"],
|
type_name=insert_type["type_name"],
|
||||||
)
|
)
|
||||||
created_build_type = BuildTypes.find_or_create(**build_types.model_dump())
|
created_build_type = BuildTypes.find_or_create(**build_types.model_dump())
|
||||||
created_build_type.save()
|
created_build_type.save_and_confirm()
|
||||||
created_build_type.update(is_confirmed=True)
|
|
||||||
created_build_type.save()
|
|
||||||
|
|
||||||
insert_enums = [
|
insert_enums = [
|
||||||
{"enum_class": "BuildDuesTypes", "type_code": "BDT-D", "type_name": "Debit"},
|
{
|
||||||
|
"enum_class": "BuildDuesTypes",
|
||||||
|
"type_code": "BDT-D",
|
||||||
|
"type_name": "Debit"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"enum_class": "BuildDuesTypes",
|
"enum_class": "BuildDuesTypes",
|
||||||
"type_code": "BDT-A",
|
"type_code": "BDT-A",
|
||||||
|
|
@ -243,14 +245,4 @@ def init_api_enums_build_types():
|
||||||
key=str(insert_enum["type_code"]).upper(),
|
key=str(insert_enum["type_code"]).upper(),
|
||||||
description=insert_enum["type_name"],
|
description=insert_enum["type_name"],
|
||||||
)
|
)
|
||||||
created_api_enum.save()
|
created_api_enum.save_and_confirm()
|
||||||
created_api_enum.update(is_confirmed=True)
|
|
||||||
created_api_enum.save()
|
|
||||||
|
|
||||||
# for insert_meeting_type in insert_meeting_types:
|
|
||||||
# ApiEnumDropdown.find_or_create(
|
|
||||||
# enum_class=insert_meeting_type["enum_class"],
|
|
||||||
# value=insert_meeting_type["value"],
|
|
||||||
# key=str(insert_meeting_type["key"]).upper(),
|
|
||||||
# description=insert_meeting_type["description"],
|
|
||||||
# )
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
"part_no" : 11,
|
"part_no" : 11,
|
||||||
"part_level" : 3,
|
"part_level" : 3,
|
||||||
"part_code" : "DAIRE_11",
|
"part_code" : "DAIRE_11",
|
||||||
"part_gross_size" : 95,
|
"part_gross_size" : 91,
|
||||||
"part_net_size" : 90,
|
"part_net_size" : 88,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -42,8 +42,8 @@
|
||||||
"part_no" : 5,
|
"part_no" : 5,
|
||||||
"part_level" : 1,
|
"part_level" : 1,
|
||||||
"part_code" : "DAIRE_05",
|
"part_code" : "DAIRE_05",
|
||||||
"part_gross_size" : 95,
|
"part_gross_size" : 91,
|
||||||
"part_net_size" : 90,
|
"part_net_size" : 88,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -80,7 +80,7 @@
|
||||||
"part_level" : 0,
|
"part_level" : 0,
|
||||||
"part_code" : "DAIRE_03",
|
"part_code" : "DAIRE_03",
|
||||||
"part_gross_size" : 85,
|
"part_gross_size" : 85,
|
||||||
"part_net_size" : 80,
|
"part_net_size" : 82,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -117,7 +117,7 @@
|
||||||
"part_level" : 0,
|
"part_level" : 0,
|
||||||
"part_code" : "DAIRE_02",
|
"part_code" : "DAIRE_02",
|
||||||
"part_gross_size" : 85,
|
"part_gross_size" : 85,
|
||||||
"part_net_size" : 80,
|
"part_net_size" : 82,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -153,8 +153,8 @@
|
||||||
"part_no" : 4,
|
"part_no" : 4,
|
||||||
"part_level" : 1,
|
"part_level" : 1,
|
||||||
"part_code" : "DAIRE_04",
|
"part_code" : "DAIRE_04",
|
||||||
"part_gross_size" : 95,
|
"part_gross_size" : 91,
|
||||||
"part_net_size" : 90,
|
"part_net_size" : 88,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -190,8 +190,8 @@
|
||||||
"part_no" : 6,
|
"part_no" : 6,
|
||||||
"part_level" : 1,
|
"part_level" : 1,
|
||||||
"part_code" : "DAIRE_06",
|
"part_code" : "DAIRE_06",
|
||||||
"part_gross_size" : 95,
|
"part_gross_size" : 91,
|
||||||
"part_net_size" : 90,
|
"part_net_size" : 88,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -227,8 +227,8 @@
|
||||||
"part_no" : 7,
|
"part_no" : 7,
|
||||||
"part_level" : 2,
|
"part_level" : 2,
|
||||||
"part_code" : "DAIRE_07",
|
"part_code" : "DAIRE_07",
|
||||||
"part_gross_size" : 95,
|
"part_gross_size" : 91,
|
||||||
"part_net_size" : 90,
|
"part_net_size" : 88,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -264,8 +264,8 @@
|
||||||
"part_no" : 8,
|
"part_no" : 8,
|
||||||
"part_level" : 2,
|
"part_level" : 2,
|
||||||
"part_code" : "DAIRE_08",
|
"part_code" : "DAIRE_08",
|
||||||
"part_gross_size" : 95,
|
"part_gross_size" : 91,
|
||||||
"part_net_size" : 90,
|
"part_net_size" : 88,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -301,8 +301,8 @@
|
||||||
"part_no" : 10,
|
"part_no" : 10,
|
||||||
"part_level" : 3,
|
"part_level" : 3,
|
||||||
"part_code" : "DAIRE_10",
|
"part_code" : "DAIRE_10",
|
||||||
"part_gross_size" : 95,
|
"part_gross_size" : 91,
|
||||||
"part_net_size" : 90,
|
"part_net_size" : 88,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -338,8 +338,8 @@
|
||||||
"part_no" : 12,
|
"part_no" : 12,
|
||||||
"part_level" : 3,
|
"part_level" : 3,
|
||||||
"part_code" : "DAIRE_12",
|
"part_code" : "DAIRE_12",
|
||||||
"part_gross_size" : 95,
|
"part_gross_size" : 91,
|
||||||
"part_net_size" : 90,
|
"part_net_size" : 88,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -375,8 +375,8 @@
|
||||||
"part_no" : 9,
|
"part_no" : 9,
|
||||||
"part_level" : 2,
|
"part_level" : 2,
|
||||||
"part_code" : "DAIRE_09",
|
"part_code" : "DAIRE_09",
|
||||||
"part_gross_size" : 95,
|
"part_gross_size" : 91,
|
||||||
"part_net_size" : 90,
|
"part_net_size" : 88,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
@ -413,7 +413,7 @@
|
||||||
"part_level" : 0,
|
"part_level" : 0,
|
||||||
"part_code" : "DAIRE_01",
|
"part_code" : "DAIRE_01",
|
||||||
"part_gross_size" : 85,
|
"part_gross_size" : 85,
|
||||||
"part_net_size" : 80,
|
"part_net_size" : 82,
|
||||||
"default_accessory" : "0",
|
"default_accessory" : "0",
|
||||||
"human_livable" : true,
|
"human_livable" : true,
|
||||||
"due_part_key" : "",
|
"due_part_key" : "",
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ login_creds_occupant = {
|
||||||
"access_key": access_key_president,
|
"access_key": access_key_president,
|
||||||
"password": "string",
|
"password": "string",
|
||||||
"remember_me": False,
|
"remember_me": False,
|
||||||
"password_token": "n6CCVhj0gvEqENWhA7OqG1NNczJWPuPgI2U6G9yE_OS8gIYGkFhqsZ9c0K9He7yx7O7T9zgaj7ZDxb1JVKzTnGIGrpv8mDdOhuB0IV20XsTsir_jzzHspXsrcHDLk6l32_qsI4fLswDPjY0qvB1yqnEjRvHuYGhfPYTifwfax2O2ceNwwYoTFU9P2s4eWzDb"
|
"password_token": ""
|
||||||
}
|
}
|
||||||
wrt_creds_occupant = {
|
wrt_creds_occupant = {
|
||||||
"domain": "evyos.com.tr",
|
"domain": "evyos.com.tr",
|
||||||
|
|
@ -67,38 +67,27 @@ both_apis = BothAPIS()
|
||||||
# both_apis.wag_api = wag_api
|
# both_apis.wag_api = wag_api
|
||||||
both_apis.local_api = local_api
|
both_apis.local_api = local_api
|
||||||
|
|
||||||
assign_people_to_create_item = 2
|
assign_people_to_create_item = -1
|
||||||
|
|
||||||
# selection_list = None
|
# selection_list = None
|
||||||
selection_list = [
|
selection_list = [
|
||||||
"98f1207d-f241-4cb8-a95a-b51266632cc8",
|
|
||||||
"a8eaf383-7bb6-489b-b9e8-f19f9fd1c197",
|
|
||||||
]
|
]
|
||||||
# selection_list = None
|
# selection_list = None
|
||||||
manager_token = "9TdLKsYaGIrDQrKHnB13SZ5Z7XIjvGRquMBXu4om5z30hKXIH7J55Q"
|
manager_token = ""
|
||||||
writers_token = manager_token
|
writers_token = manager_token
|
||||||
people_uu_id_list = [
|
people_uu_id_list = [
|
||||||
"af411e80-29ad-4540-9e74-3c805700f461",
|
# "af411e80-29ad-4540-9e74-3c805700f461",
|
||||||
"af411e80-29ad-4540-9e74-3c805700f461",
|
# "af411e80-29ad-4540-9e74-3c805700f461",
|
||||||
"af411e80-29ad-4540-9e74-3c805700f461",
|
# "af411e80-29ad-4540-9e74-3c805700f461",
|
||||||
]
|
]
|
||||||
list_of_attendees = [
|
list_of_attendees = [
|
||||||
"Qsf0XO6c-wTZDhACY66S4Ck21fgW-6E0f1dSi61bSskMAI7qUTH2Eg",
|
|
||||||
"fjAc8_mktkBw46islaa8H1yM5jptwLcsdDbNz_MuH7gPmZtuNZ4zLw",
|
|
||||||
"JwVbDMl6CQZTIFu4LEwdEaX8BB6syWPgygF0f3M0fiu9VhPaqdLzfw",
|
|
||||||
"PFBj2hlhRAFxrxpUMCpE0O_kwKrWvTov4Zxn94MMnYcVMzC1kQNmiQ",
|
|
||||||
"e8MKAguhQnSyuZtL1UVP4a3xx0zbXGEmLUQrbCEJu15VoO0r33otdA",
|
|
||||||
"VPmcs0xD3N5RUGDyYRCe-adgvspkhiMb5YWfr7oN8fCvcQq9BTLSkA",
|
|
||||||
"3xtEg2r1qi8PozE2Qte4fFuz2EjARP8uxRRS18nz6_OFGQ142rZk4g",
|
|
||||||
"89XH0UXxbujs-uKxBMV8fZEMJkBDnxOr_8ZBbxS7isGD2noY_OpI4w",
|
|
||||||
"jSb8rH1ZI7BSHYUtBsKsOoTW4LnHDY2JlJhid_YgpIg05CI-veX0fA",
|
|
||||||
"fMysLzIehzVfYlnqcyPLpaAKaxD8IODe5QXmWbiM1gEVYtUMyTg-xw",
|
|
||||||
"aS5AydqghcvTGMQHGpi3m9C5OgyQQ_Yyc_jnkNUzrBvuEuNGOgMgPA",
|
|
||||||
]
|
]
|
||||||
living_space_data = dict(
|
living_space_data = dict(
|
||||||
build_parts_uu_id="98f1207d-f241-4cb8-a95a-b51266632cc8",
|
build_parts_uu_id="",
|
||||||
person_uu_id="07a14d03-d8c8-4d84-9f71-ff81b732b030",
|
person_uu_id="",
|
||||||
occupant_type_uu_id="a8eaf383-7bb6-489b-b9e8-f19f9fd1c197",
|
occupant_type_uu_id="",
|
||||||
expiry_starts=arrow.now().date().__str__(),
|
expiry_starts=arrow.now().date().__str__(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -181,6 +170,12 @@ elif assign_people_to_create_item == 3:
|
||||||
is_password_valid=True,
|
is_password_valid=True,
|
||||||
selection_list=selection_list,
|
selection_list=selection_list,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
debit_type_uu_id = ""
|
||||||
|
|
||||||
selected_decision_book_uu_id = list_decision_books(requester=both_apis.local_api)["data"][0]["uu_id"]
|
selected_decision_book_uu_id = list_decision_books(requester=both_apis.local_api)["data"][0]["uu_id"]
|
||||||
print("select_company_uu_id", local_api.selected_object)
|
print("select_company_uu_id", local_api.selected_object)
|
||||||
is_fixed_price = False
|
is_fixed_price = False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue