Integrate audit checklist responses into service tasks

This commit is contained in:
A R R R Associates
2026-07-19 21:59:24 +05:30
parent 05b736b6c9
commit df52845194
10 changed files with 383 additions and 10 deletions
+32 -1
View File
@@ -1,8 +1,9 @@
from __future__ import annotations
from datetime import date, datetime, timezone
from decimal import Decimal
from sqlalchemy import Boolean, Date, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint
from sqlalchemy import Boolean, Date, DateTime, ForeignKey, Integer, Numeric, String, Text, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column, relationship
from app.core.db.common import CommonBase
@@ -112,6 +113,15 @@ class ServiceDefaultTaskTemplate(CommonBase):
is_mandatory: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
requires_review: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
# Structured checklist controls. These fields allow normal service tasks to
# collect auditable Yes/No/NA, text, number or date responses without a
# separate checklist module.
task_category: Mapped[str | None] = mapped_column(String(100), nullable=True, index=True)
response_required: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
response_type: Mapped[str] = mapped_column(String(20), default="NONE", nullable=False)
evidence_required: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
remarks_required_if_no: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
# AQMM task tags. These flags allow the existing service checklist to become
# the engagement quality checklist for assurance engagements, without creating
# a separate duplicate AQMM checklist module.
@@ -180,6 +190,13 @@ class FirmServiceTaskTemplate(CommonBase):
is_mandatory: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
requires_review: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
# Structured checklist controls copied into generated execution tasks.
task_category: Mapped[str | None] = mapped_column(String(100), nullable=True, index=True)
response_required: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
response_type: Mapped[str] = mapped_column(String(20), default="NONE", nullable=False)
evidence_required: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
remarks_required_if_no: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
# AQMM task tags copied into generated ClientServiceTaskInstance rows.
is_aqmm_task: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False, index=True)
aqmm_mandatory: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
@@ -652,6 +669,20 @@ class ClientServiceTaskInstance(CommonBase):
status: Mapped[str] = mapped_column(String(30), nullable=False, default="pending", index=True)
priority: Mapped[str] = mapped_column(String(20), nullable=False, default="normal")
# Structured checklist definition copied from the firm task template.
task_category: Mapped[str | None] = mapped_column(String(100), nullable=True, index=True)
response_required: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
response_type: Mapped[str] = mapped_column(String(20), default="NONE", nullable=False)
evidence_required: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
remarks_required_if_no: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
# Structured response values entered during task execution.
checklist_response: Mapped[str | None] = mapped_column(String(10), nullable=True)
checklist_text_response: Mapped[str | None] = mapped_column(Text, nullable=True)
checklist_number_response: Mapped[Decimal | None] = mapped_column(Numeric(18, 2), nullable=True)
checklist_date_response: Mapped[date | None] = mapped_column(Date, nullable=True)
checklist_remarks: Mapped[str | None] = mapped_column(Text, nullable=True)
# Copied from FirmServiceTaskTemplate at generation time. Existing task
# completion/evidence upload flow is reused to calculate AQMM quality status.
is_aqmm_task: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False, index=True)