Add task administration upgrade with duplicate merge and task tools

This commit is contained in:
A R R R Associates
2026-08-30 22:12:27 +05:30
parent ad0815c807
commit af4f6e8b28
17 changed files with 2072 additions and 14 deletions
+48
View File
@@ -0,0 +1,48 @@
from __future__ import annotations
from dataclasses import dataclass
@dataclass(frozen=True)
class TaskToolDefinition:
code: str
name: str
description: str
launch_url: str | None = None
_TASK_TOOLS: tuple[TaskToolDefinition, ...] = (
TaskToolDefinition(code="NONE", name="None", description="Normal task workflow without an attached ERP tool."),
TaskToolDefinition(
code="ACCOUNTING_OPENING_BALANCE",
name="Opening Balance Review",
description="Launch the existing Tally opening-balance comparison and verification tool.",
launch_url="/tools/accounting/opening-balances",
),
TaskToolDefinition(
code="ACCOUNTING_BANK_RECONCILIATION",
name="Bank Reconciliation",
description="Launch the existing accounting bank-reconciliation workspace.",
launch_url="/tools/accounting/bank-reconciliation",
),
)
def list_task_tools() -> list[TaskToolDefinition]:
return list(_TASK_TOOLS)
def get_task_tool(code: str | None) -> TaskToolDefinition:
normalized = normalize_task_tool_code(code)
for tool in _TASK_TOOLS:
if tool.code == normalized:
return tool
return _TASK_TOOLS[0]
def normalize_task_tool_code(code: str | None) -> str:
value = (code or "NONE").strip().upper() or "NONE"
valid = {tool.code for tool in _TASK_TOOLS}
if value not in valid:
raise ValueError(f"Unsupported task tool: {value}")
return value