From 0790d2e6df40e961719b48d1317abcab98d5ead8 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 2 Jul 2026 15:09:00 +0530 Subject: [PATCH] fix(manufacturing): include last-day records in Production Analytics `get_work_orders` bounded a BETWEEN on the datetime columns `creation` and `actual_end_date` with a bare date `to_date`, which MariaDB coerces to midnight. Work orders created after 00:00:00 on the period's last day were therefore dropped from the report (and made the new coverage test fail on month-end CI runs). Extend `to_date` to end of day. --- .../report/production_analytics/production_analytics.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/report/production_analytics/production_analytics.py b/erpnext/manufacturing/report/production_analytics/production_analytics.py index 9da87022e46..2fbd42210af 100644 --- a/erpnext/manufacturing/report/production_analytics/production_analytics.py +++ b/erpnext/manufacturing/report/production_analytics/production_analytics.py @@ -4,7 +4,7 @@ import frappe from frappe import _, scrub -from frappe.utils import getdate, today +from frappe.utils import get_datetime, getdate, today from erpnext.stock.report.stock_analytics.stock_analytics import ( get_period, @@ -31,7 +31,9 @@ def get_columns(period_columns): def get_work_orders(filters): from_date = filters.get("from_date") - to_date = filters.get("to_date") + # `creation` and `actual_end_date` are datetime columns, so a bare date upper + # bound would coerce to midnight and drop records created later on the last day. + to_date = get_datetime(filters.get("to_date")).replace(hour=23, minute=59, second=59) WorkOrder = frappe.qb.DocType("Work Order")