Add engagement closure checklist workflow
This commit is contained in:
@@ -563,6 +563,61 @@ class EngagementLetter(CommonBase):
|
||||
created_by = relationship("User", foreign_keys=[created_by_user_id])
|
||||
|
||||
|
||||
class EngagementClosureChecklist(CommonBase):
|
||||
"""Engagement closure checklist attached to the existing engagement.
|
||||
|
||||
Closure is the final file-completion gate. It summarises evidence already
|
||||
available in AQMM acceptance, AQMM-tagged tasks, task documents/reviews,
|
||||
final released documents and UDIN controls. Only a few closure confirmations
|
||||
are manual; the rest are calculated from the existing workflow.
|
||||
"""
|
||||
|
||||
__tablename__ = "engagement_closure_checklists"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("subscription_id", name="uq_engagement_closure_subscription"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
tenant_id: Mapped[int] = mapped_column(ForeignKey("tenants.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
branch_id: Mapped[int | None] = mapped_column(ForeignKey("branches.id", ondelete="SET NULL"), nullable=True, index=True)
|
||||
client_id: Mapped[int] = mapped_column(ForeignKey("clients.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
subscription_id: Mapped[int] = mapped_column(ForeignKey("client_service_subscriptions.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
|
||||
closure_status: Mapped[str] = mapped_column(String(40), nullable=False, default="not_started", index=True)
|
||||
|
||||
aqmm_acceptance_completed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
aqmm_tasks_completed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
evidence_review_completed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
final_documents_released: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
udin_completed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
normal_tasks_completed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
|
||||
deliverables_sent_to_client: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
billing_reviewed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
open_points_closed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
client_communication_completed: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
|
||||
closure_note: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
closure_block_reason: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
|
||||
closure_approved_by_user_id: Mapped[int | None] = mapped_column(ForeignKey("users.id", ondelete="SET NULL"), nullable=True, index=True)
|
||||
closure_approved_at_utc: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
reopened_by_user_id: Mapped[int | None] = mapped_column(ForeignKey("users.id", ondelete="SET NULL"), nullable=True, index=True)
|
||||
reopened_at_utc: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
reopen_reason: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
|
||||
created_by_user_id: Mapped[int | None] = mapped_column(ForeignKey("users.id", ondelete="SET NULL"), nullable=True)
|
||||
created_at_utc: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc), nullable=False)
|
||||
updated_at_utc: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc), onupdate=lambda: datetime.now(timezone.utc), nullable=False)
|
||||
|
||||
subscription = relationship("ClientServiceSubscription")
|
||||
client = relationship("Client")
|
||||
closure_approved_by = relationship("User", foreign_keys=[closure_approved_by_user_id])
|
||||
reopened_by = relationship("User", foreign_keys=[reopened_by_user_id])
|
||||
created_by = relationship("User", foreign_keys=[created_by_user_id])
|
||||
|
||||
|
||||
class ClientServiceTaskInstance(CommonBase):
|
||||
"""Execution task generated from a firm service task template for a client-service subscription."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user