From 37e2c37e27efa215b44791e151c85bddebeb2db5 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Fri, 31 Jan 2025 15:56:42 +0100 Subject: [PATCH 1/2] fix: Always cast date filter before adding minutes --- .../batch_wise_balance_history.py | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py index a31d23934f8..641f4518528 100644 --- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py +++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py @@ -4,8 +4,7 @@ import frappe from frappe import _ -from frappe.utils import add_to_date, cint, flt, get_datetime, get_table_name, getdate -from frappe.utils.deprecations import deprecated +from frappe.utils import add_to_date, cint, flt, get_date_str, get_datetime, get_table_name, getdate from pypika import functions as fn from erpnext.stock.doctype.warehouse.warehouse import apply_warehouse_filter @@ -77,18 +76,18 @@ def execute(filters=None): def get_columns(filters): """return columns based on filters""" - columns = ( - [_("Item") + ":Link/Item:100"] - + [_("Item Name") + "::150"] - + [_("Description") + "::150"] - + [_("Warehouse") + ":Link/Warehouse:100"] - + [_("Batch") + ":Link/Batch:100"] - + [_("Opening Qty") + ":Float:90"] - + [_("In Qty") + ":Float:80"] - + [_("Out Qty") + ":Float:80"] - + [_("Balance Qty") + ":Float:90"] - + [_("UOM") + "::90"] - ) + columns = [ + _("Item") + ":Link/Item:100", + _("Item Name") + "::150", + _("Description") + "::150", + _("Warehouse") + ":Link/Warehouse:100", + _("Batch") + ":Link/Batch:100", + _("Opening Qty") + ":Float:90", + _("In Qty") + ":Float:80", + _("Out Qty") + ":Float:80", + _("Balance Qty") + ":Float:90", + _("UOM") + "::90", + ] return columns @@ -151,7 +150,7 @@ def get_stock_ledger_entries_for_batch_bundle(filters): sle = frappe.qb.DocType("Stock Ledger Entry") batch_package = frappe.qb.DocType("Serial and Batch Entry") - to_date = get_datetime(filters.to_date + " 23:59:59") + to_date = get_datetime(get_date_str(filters.to_date) + " 23:59:59") query = ( frappe.qb.from_(sle) -- GitLab From dd3f75d7dabbbea9cc663353362ab7b34d8c7ec8 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Sat, 1 Feb 2025 13:42:31 +0000 Subject: [PATCH 2/2] fix: missing import --- .../batch_wise_balance_history/batch_wise_balance_history.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py index 641f4518528..60beca0d907 100644 --- a/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py +++ b/erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py @@ -5,6 +5,7 @@ import frappe from frappe import _ from frappe.utils import add_to_date, cint, flt, get_date_str, get_datetime, get_table_name, getdate +from frappe.utils.deprecations import deprecated from pypika import functions as fn from erpnext.stock.doctype.warehouse.warehouse import apply_warehouse_filter -- GitLab