Lege Anlagen und Versandbelege direkt am Schriftstueck ab, damit die Zuordnung aus dem Vorgang gezogen werden kann und mehrere Belege an einem Versand bleiben.
Deploy Development / deploy (push) Successful in 26s
Test Suite / pytest-backend (push) Successful in 1m35s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-18 10:35:32 +02:00
1 parent c138df5e68
commit c774fb7206
9 files changed
+663 -200

No files matched your search

+21
View File
@@ -14,6 +14,7 @@ from app.api.schemas import (
AttachmentDetachIn,
AttachmentOrderIn,
DispatchCorrectIn,
DispatchEvidenceDetachIn,
DispatchEvidenceIn,
DispatchIn,
FoldIn,
@@ -22,6 +23,7 @@ from app.correspondence import (
GapNote,
add_dispatch_evidence,
assign_attachments,
detach_dispatch_evidence,
correct_dispatch,
detach_attachment,
dispatch_view,
@@ -173,6 +175,25 @@ def post_evidence(
)
@router.post("/api/v1/dispatches/{dispatch_id}/evidence/{element_id}/detach", status_code=204)
def post_detach_evidence(
dispatch_id: UUID,
element_id: UUID,
body: DispatchEvidenceDetachIn,
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
detach_dispatch_evidence(
conn,
principal.account_id,
dispatch_id,
element_id,
body.expected_version,
_ctx(body.context),
_placement(body.placement),
)
@router.post("/api/v1/dispatches/{dispatch_id}/correct")
def post_correct(
dispatch_id: UUID,
+6
View File
@@ -424,6 +424,12 @@ class DispatchEvidenceIn(APIModel):
fold: Literal["keep", "evidence"] = "keep"
class DispatchEvidenceDetachIn(APIModel):
expected_version: int = Field(ge=1)
context: ContextIn
placement: ContextIn | None = None
class DispatchCorrectIn(APIModel):
expected_version: int = Field(ge=1)
context: ContextIn
+39
View File
@@ -291,6 +291,33 @@ def add_dispatch_evidence(
return row
def detach_dispatch_evidence(
conn,
actor: UUID,
dispatch_id: UUID,
element_id: UUID,
expected: int,
context: Ctx,
placement: Ctx | None,
) -> None:
container_row, page, scope = open_container(conn, actor, context, placement, "edit")
dispatch = _dispatch_in(conn, dispatch_id, scope)
_bump_dispatch(conn, dispatch_id, expected)
deleted = conn.execute(
"""
DELETE FROM dispatch_evidence
WHERE dispatch_id = %s AND element_id = %s
RETURNING id
""",
(dispatch_id, element_id),
).fetchone()
if deleted is None:
raise not_found()
_clear_evidence_fold(conn, scope, element_id)
_log(conn, dispatch_id, actor, "Nachweis aus diesem Versand gelöst")
audit(conn, actor, container_row["home_scope_id"], "dispatch_evidence_detached", "element", dispatch["host_element_id"], page)
def correct_dispatch(
conn,
actor: UUID,
@@ -1254,6 +1281,18 @@ def _set_binding_fold(conn, scope: Ctx, element_id: UUID, fold: str) -> None:
)
def _clear_evidence_fold(conn, scope: Ctx, element_id: UUID) -> None:
if _is_evidence(conn, scope, element_id):
return
conn.execute(
"""
UPDATE bindings SET list_fold = NULL
WHERE element_id = %s AND context_kind = %s AND context_id = %s AND list_fold = 'evidence'
""",
(element_id, scope.kind, scope.id),
)
def _clear_attachment_fold(conn, scope: Ctx, element_id: UUID) -> None:
if _is_attachment(conn, scope, element_id):
return