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.
This commit is contained in:
Nabin Hait
2026-07-02 15:09:00 +05:30
parent ece8c9538d
commit 0790d2e6df

View File

@@ -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")