From 1bf04d45b174d87c2f220065110567553e256344 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 27 Jan 2026 07:10:25 +0100 Subject: [PATCH] feat: Extend invoice filter to 13 months for yearly items v1.3.137: - Changed from 12 to 13 months lookback - Ensures yearly billed items are visible - Example: Jan 27, 2026 -> fetches from Jan 1, 2025 --- VERSION | 2 +- app/services/economic_service.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 8056afa..67067fa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.136 \ No newline at end of file +1.3.137 \ No newline at end of file diff --git a/app/services/economic_service.py b/app/services/economic_service.py index 0cf3d7e..07c097b 100644 --- a/app/services/economic_service.py +++ b/app/services/economic_service.py @@ -450,18 +450,19 @@ class EconomicService: List of invoice records with lines from the last year """ try: - # Calculate first day of the month 12 months ago + # Calculate first day of the month 13 months ago (for yearly billed items) now = datetime.now() - # Go back 12 months - if now.month > 12: - start_month = now.month - 12 + # Go back 13 months + months_back = 13 + if now.month > months_back: + start_month = now.month - months_back start_year = now.year else: - start_month = 12 - (12 - now.month) + start_month = 12 - (months_back - now.month) start_year = now.year - 1 start_date = datetime(start_year, start_month, 1).strftime('%Y-%m-%d') - logger.info(f"📅 Fetching invoices from {start_date} onwards (12 months from 1st of month)") + logger.info(f"📅 Fetching invoices from {start_date} onwards (13 months for yearly billed items)") async with aiohttp.ClientSession() as session: # Try multiple endpoints to find invoices