feat: add persistent monthly settlement drafts and approved valuation selection

This commit is contained in:
2026-10-10 02:49:34 +00:00
parent 68212e773b
commit 92f44661c3
37 changed files with 2902 additions and 29 deletions
+41
View File
@@ -443,3 +443,44 @@ def main() -> None:
if __name__ == "__main__":
main()
@mcp.tool()
def create_settlement_draft(month: str, created_by: str, idempotency_key: str, basis_date: str = "", memo: str = "", correction_of_run_id: str = "", correction_reason: str = "") -> dict:
return contracts.create_settlement_draft(month, created_by, idempotency_key, basis_date, memo, correction_of_run_id, correction_reason)
@mcp.tool()
def list_settlement_drafts(month: str = "") -> dict:
return contracts.list_settlement_drafts(month)
@mcp.tool()
def get_settlement_draft(draft_id: str) -> dict:
return contracts.get_settlement_draft(draft_id)
@mcp.tool()
def update_settlement_draft(draft_id: str, expected_version: int, updated_by: str, memo: str) -> dict:
return contracts.update_settlement_draft(draft_id, expected_version, updated_by, memo)
@mcp.tool()
def refresh_settlement_draft_targets(draft_id: str, expected_version: int, updated_by: str) -> dict:
return contracts.refresh_settlement_draft_targets(draft_id, expected_version, updated_by)
@mcp.tool()
def set_settlement_draft_item(draft_id: str, source_type: str, source_id: str, expected_version: int, selected_by: str, valuation_id: str = "", selection_mode: str = "exact", selection_reason: str = "", included: bool = True, exclusion_reason: str = "") -> dict:
return contracts.set_settlement_draft_item(draft_id, source_type, source_id, expected_version, selected_by, valuation_id, selection_mode, selection_reason, included, exclusion_reason)
@mcp.tool()
def review_settlement_draft(draft_id: str) -> dict:
return contracts.review_settlement_draft(draft_id)
@mcp.tool()
def approve_settlement_draft(draft_id: str, expected_version: int, review_fingerprint: str, approved_by: str, approval_reason: str, approval_reference: str, allow_missing_exclusions: bool = False, allow_carried_before: bool = False, allow_manual_substitute: bool = False) -> dict:
return contracts.approve_settlement_draft(draft_id, expected_version, review_fingerprint, approved_by, approval_reason, approval_reference, allow_missing_exclusions, allow_carried_before, allow_manual_substitute)
@mcp.tool()
def finalize_settlement_draft(draft_id: str, expected_version: int, review_fingerprint: str, idempotency_key: str) -> dict:
return contracts.finalize_settlement_draft(draft_id, expected_version, review_fingerprint, idempotency_key)
@mcp.tool()
def cancel_settlement_draft(draft_id: str, expected_version: int, cancelled_by: str, reason: str) -> dict:
return contracts.cancel_settlement_draft(draft_id, expected_version, cancelled_by, reason)
@@ -1,6 +1,16 @@
from __future__ import annotations
from ...service import (
approve_settlement_draft as approve_settlement_draft,
cancel_settlement_draft as cancel_settlement_draft,
create_settlement_draft as create_settlement_draft,
finalize_settlement_draft as finalize_settlement_draft,
get_settlement_draft as get_settlement_draft,
list_settlement_drafts as list_settlement_drafts,
refresh_settlement_draft_targets as refresh_settlement_draft_targets,
review_settlement_draft as review_settlement_draft,
set_settlement_draft_item as set_settlement_draft_item,
update_settlement_draft as update_settlement_draft,
annotations as annotations,
apply_categorization_rules as apply_categorization_rules,
close_asset_snapshot as close_asset_snapshot,
@@ -74,7 +84,21 @@ from ...service import (
update_manual_asset as update_manual_asset,
)
TOOL_CONTRACTS = {
name: globals()[name]
for name in (
"create_settlement_draft", "list_settlement_drafts", "get_settlement_draft",
"update_settlement_draft", "refresh_settlement_draft_targets",
"set_settlement_draft_item", "review_settlement_draft",
"approve_settlement_draft", "finalize_settlement_draft", "cancel_settlement_draft",
)
}
__all__ = [
"approve_settlement_draft", "cancel_settlement_draft", "create_settlement_draft",
"finalize_settlement_draft", "get_settlement_draft", "list_settlement_drafts",
"refresh_settlement_draft_targets", "review_settlement_draft",
"set_settlement_draft_item", "update_settlement_draft",
"annotations",
"apply_categorization_rules",
"close_asset_snapshot",