fix(estimates): allow approved estimate revocation

This commit is contained in:
Schubert Ferenc 2026-07-05 12:26:45 +02:00
parent 31bdc1047d
commit 8d37eb29b3
14 changed files with 295 additions and 8 deletions

View file

@ -225,7 +225,13 @@ class InventoryService:
)
@staticmethod
def release_estimate_reservation(db: Session, estimate: RepairEstimate, *, actor_user_id: int | None) -> None:
def release_estimate_reservation(
db: Session,
estimate: RepairEstimate,
*,
actor_user_id: int | None,
reason: str = "estimate_released",
) -> None:
for estimate_item in estimate.items:
if estimate_item.inventory_item_id is None:
continue
@ -240,7 +246,7 @@ class InventoryService:
item_id=item.id,
movement_type="release",
quantity=quantity,
reason="estimate_released",
reason=reason,
reference_type="repair_estimate",
reference_id=estimate.id,
note=f"Kostenvoranschlag {estimate.estimate_number}",