From f8ea119d229443aec6c97d98ea6f8f3983473450 Mon Sep 17 00:00:00 2001 From: bot-backend Date: Wed, 17 Jun 2026 20:27:57 +0300 Subject: [PATCH] fix(tradein): trade-in PDF cover uses estimate.expires_at, not hardcoded +30d (#1530) --- tradein-mvp/backend/app/services/exporters/trade_in_pdf.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tradein-mvp/backend/app/services/exporters/trade_in_pdf.py b/tradein-mvp/backend/app/services/exporters/trade_in_pdf.py index 0ad4e170..2b8f6c30 100644 --- a/tradein-mvp/backend/app/services/exporters/trade_in_pdf.py +++ b/tradein-mvp/backend/app/services/exporters/trade_in_pdf.py @@ -449,7 +449,12 @@ def _dual_price_block(estimate: AggregatedEstimate, brand) -> str: # type: igno def _build_cover(estimate: AggregatedEstimate, input_snapshot: dict, brand) -> str: # type: ignore[no-untyped-def,type-arg] today = dt.date.today() - expires = today + dt.timedelta(days=30) + # Используем реальное поле expires_at из оценки; fallback на +30 дней если None. + expires = ( + estimate.expires_at.date() + if estimate.expires_at is not None + else today + dt.timedelta(days=30) + ) report_num = _report_number(estimate.estimate_id) # Короткий адрес (для cover): берём первую часть до запятой