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